mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-24 10:46:50 -06:00
- #2369: its test joins the single ui-egui integration-test binary (tests/it), as main now builds them. - #2367: a cell set to empty text is a blank entry and doesn't grow the AutoFilter (CodeRabbit). - #2387: MOD's range check also covers the sign-corrected remainder (CodeRabbit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
81fd0f6f7d
commit
7cf44d0fbb
@@ -656,7 +656,7 @@ fn filter_blank(v: &Value) -> bool {
|
||||
/// A table's own filter is left to the table, and a row typed after a blank row does not count.
|
||||
/// A formula counts before it is calculated: this runs inside the edit, ahead of the recalc.
|
||||
pub(crate) fn grow_autofilter(sh: &mut Sheet, at: CellRef) {
|
||||
if !sh.cells.get(at).is_some_and(|c| !c.value.is_empty() || c.formula.is_some()) {
|
||||
if !sh.cells.get(at).is_some_and(|c| !filter_blank(&c.value) || c.formula.is_some()) {
|
||||
return;
|
||||
}
|
||||
let Some(af) = sh.autofilter.as_ref() else { return };
|
||||
@@ -1589,6 +1589,9 @@ mod tests {
|
||||
// A cell outside the filter's columns does not either.
|
||||
s.execute("cell.set", json!({"cell": "C6", "input": "x"})).unwrap();
|
||||
assert_eq!(range(&s), Some("A1:B5".to_string()));
|
||||
// Empty text is a blank entry, not a value.
|
||||
s.execute("range.setValues", json!({"range": "A6", "parse": false, "values": [[""]]})).unwrap();
|
||||
assert_eq!(range(&s), Some("A1:B5".to_string()));
|
||||
// A formula and Ctrl+Enter (range.fill) are entries too.
|
||||
s.execute("cell.set", json!({"cell": "B6", "input": "=1+1"})).unwrap();
|
||||
assert_eq!(range(&s), Some("A1:B6".to_string()));
|
||||
|
||||
@@ -309,9 +309,7 @@ fn modulo(x: f64, d: f64) -> R<f64> {
|
||||
// `%` is an exact remainder (truncated), so |r| < |d| even for tiny divisors.
|
||||
let r = x % d;
|
||||
// Keep the sign of the divisor and avoid returning |d| from rounding.
|
||||
if r != 0.0 && (r < 0.0) != (d < 0.0) {
|
||||
return Ok(r + d);
|
||||
}
|
||||
let r = if r != 0.0 && (r < 0.0) != (d < 0.0) { r + d } else { r };
|
||||
if r.abs() >= d.abs() {
|
||||
return Ok(0.0);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ mod comments_pane;
|
||||
mod commit_after_pointing;
|
||||
mod committed_text_fields;
|
||||
mod context_menu_stays_open;
|
||||
mod contextual_ribbon_tab;
|
||||
mod control_timeout;
|
||||
mod dialog_button_row;
|
||||
mod dialog_confirm;
|
||||
|
||||
Reference in New Issue
Block a user