mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-22 13:58:28 -06:00
Recalc: clearing an array frees its whole spill area for a blocked array
Clearing (or overwriting) a dynamic array's anchor empties its whole former spill area, but only arrays above and left of the anchor were re-evaluated, so an array blocked further right (F13 against C14's C14:I14) stayed #SPILL! until the next full recalculation. Reported by iluebbe on #964.
This commit is contained in:
+1
-1
@@ -158,7 +158,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in
|
||||
| 2026-10-13 | XLSX export writes a picture used on several sheets once, as one `xl/media` part every drawing points to (it wrote a copy per drawing: a 16-sheet workbook with one 112 KB logo grew from 0.4 to 1.9 MB) (#985) |
|
||||
| 2026-10-13 | XLSX: `[Content_Types].xml`, `_rels/.rels`, the workbook rels and `xl/workbook.xml` are the first zip entries (document properties last), so libmagic and PHP `finfo` detect the file type even with large properties (#1090) |
|
||||
| 2026-10-13 | Conditional formatting: a rule gathers range statistics only when it reads them (top/bottom, above average, duplicates, scales, bars, icons) and borrows them instead of copying them per cell, so the per-frame lookup of an expression or cell-value rule no longer visits its whole range (#1098, part 1) |
|
||||
| 2026-10-13 | Spills: when two dynamic arrays want the same cells, the one already spilling there keeps them after Calculate Now and after saving and reopening, as when the second was entered (#964, found by the command-sequence fuzz) |
|
||||
| 2026-10-13 | Spills: when two dynamic arrays want the same cells, the one already spilling there keeps them after Calculate Now and after saving and reopening, as when the second was entered; clearing it lets the other spill at once (#964, found by the command-sequence fuzz) |
|
||||
| 2026-10-12 | Next/previous sheet navigation stops at the first/last visible worksheet instead of activating a hidden boundary sheet; the current selection is retained |
|
||||
| 2026-10-12 | Rows auto-fit oversized fonts: opening a file and whole-row/column formatting grow non-custom rows to their tallest font (#833) |
|
||||
| 2026-10-12 | Number formats: parsing a format code is linear in its length (long runs of `[`, `,` or `/` no longer take quadratic time), and an unclosed `[` is a literal when splitting sections as well as when tokenizing (#810) |
|
||||
|
||||
@@ -1018,6 +1018,13 @@ impl Calc {
|
||||
}
|
||||
}
|
||||
}
|
||||
// A cleared anchor empties its whole former spill area too.
|
||||
for (si, r) in &cleared {
|
||||
match emptied.iter_mut().find(|x| x.0 == *si) {
|
||||
Some(x) => x.1 = CellRef::new(x.1.row.max(r.end.row), x.1.col.max(r.end.col)),
|
||||
None => emptied.push((*si, r.end)),
|
||||
}
|
||||
}
|
||||
// An emptied cell can unblock an anchor any distance above or to the left of it.
|
||||
for (si, end) in emptied {
|
||||
for &(s, c) in self.graph.nodes.keys() {
|
||||
|
||||
@@ -2472,6 +2472,20 @@ fn a_spill_that_goes_away_unblocks_another() {
|
||||
assert_eq!((v(&s, "E10"), v(&s, "G10")), (Value::Number(1.0), Value::Number(3.0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clearing_the_array_that_holds_a_contested_area_lets_the_other_spill() {
|
||||
// F13's array wants F14:G14, inside C14's spill C14:I14. Clearing C14 empties the whole
|
||||
// area, to the right of C14 too, so F13 spills straight away, as in Excel.
|
||||
let mut s = s();
|
||||
s.execute("cell.set", json!({"cell": "C14", "input": "=SEQUENCE(1,7)"})).unwrap();
|
||||
s.execute("cell.set", json!({"cell": "F13", "input": "=SEQUENCE(5,2)"})).unwrap();
|
||||
assert_eq!(v(&s, "F13"), Value::Error(gridcraft_core::CellError::Spill));
|
||||
s.execute("edit.clearContents", json!({"range": "C14"})).unwrap();
|
||||
assert_eq!((v(&s, "F13"), v(&s, "G17")), (Value::Number(1.0), Value::Number(10.0)));
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
assert_eq!((v(&s, "F13"), v(&s, "I14")), (Value::Error(gridcraft_core::CellError::Spill), Value::Number(7.0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_contested_spill_area_stays_with_its_array_after_reopening() {
|
||||
// F13's array wants F14:G14, which C14's array already fills, so F13 is #SPILL!. The file
|
||||
|
||||
Reference in New Issue
Block a user