From 4445aa6ddfb4d87892fe0eb9b3c0b2be81458382 Mon Sep 17 00:00:00 2001 From: Harrison Booth Date: Mon, 19 Oct 2026 13:31:04 -0500 Subject: [PATCH] calc: document deref's full-shape rule for bounded references The deref doc comment still said blocks are trimmed to the used range. Describe the actual rule: blocks up to FULL_SIZE_CELLS, or up to FULL_SIZE_BOUNDED_CELLS when they do not run to the sheet's edge, keep their full shape; the rest stop at the used range. Docs only. Co-Authored-By: Claude Sonnet 5.5 --- crates/calc/src/eval.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/calc/src/eval.rs b/crates/calc/src/eval.rs index 517f2fe9e..0bc68b7b7 100644 --- a/crates/calc/src/eval.rs +++ b/crates/calc/src/eval.rs @@ -158,8 +158,13 @@ impl<'h> Evaluator<'h> { Ok(self.resolve_sheet(&r.sheet)?.into_iter().map(|sheet| Area { sheet, range }).collect()) } - /// Dereferences: one cell → its value; a block → an array (trimmed to the used range); - /// several areas → `#VALUE!`. + /// Dereferences: one cell → its value; a block → an array; several areas → `#VALUE!`. + /// + /// A block keeps its full shape (blanks included) when it holds at most `FULL_SIZE_CELLS` + /// cells, or when it holds at most `FULL_SIZE_BOUNDED_CELLS` cells (one full column's worth) + /// and does not run to the sheet's last row or column. Every other block (larger, or a + /// bigger one that runs to the sheet's edge, such as `A:A` or `1:1`) is trimmed to the + /// sheet's used range before its values are read. An array over `MAX_CELLS` is `#NUM!`. pub fn deref(&mut self, ev: Ev) -> Value { match ev { Ev::V(v) => v,