fix(calc): recalculate dependents of a cleared spill past 65536 cells (#558)

This commit is contained in:
MarekSpodBiedry 2026-10-12 08:29:06 +02:00
parent 3926d21aa9
commit 1f16c2e268
2 changed files with 13 additions and 2 deletions

View File

@ -898,11 +898,11 @@ impl Calc {
// Spill areas of changed anchors also change.
for &k in changed {
if let Some(r) = wb.sheet(k.0).and_then(|s| s.spill_ranges.get(&k.1)) {
seeds.extend(r.iter().take(65536).map(|c| (k.0, c)));
seeds.extend(r.iter().map(|c| (k.0, c)));
}
}
for (si, r) in &cleared {
seeds.extend(r.iter().take(65536).map(|c| (*si, c)));
seeds.extend(r.iter().map(|c| (*si, c)));
}
let t0 = prof_now();
let dirty = self.dirty_closure(wb, &seeds);

View File

@ -1617,6 +1617,17 @@ fn replacing_a_spilling_formula_clears_its_spill() {
assert_eq!((v(&s, "A2"), v(&s, "B1")), (Value::Empty, Value::Number(0.0)));
}
#[test]
fn clearing_a_spill_past_65536_cells_updates_a_late_dependent() {
let mut s = s();
s.execute("cell.set", json!({"cell": "A1", "input": "=SEQUENCE(65537)"})).unwrap();
s.execute("cell.set", json!({"cell": "C1", "input": "=A65536"})).unwrap();
s.execute("cell.set", json!({"cell": "C2", "input": "=A65537"})).unwrap();
assert_eq!(v(&s, "C2"), Value::Number(65537.0));
s.execute("cell.set", json!({"cell": "A1", "input": "5"})).unwrap();
assert_eq!((v(&s, "C1"), v(&s, "C2")), (Value::Number(0.0), Value::Number(0.0)));
}
#[test]
fn range_ending_in_index_recalculates() {
let mut s = s();