https://bugs.documentfoundation.org/show_bug.cgi?id=174302
BogdanB <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |bibisected, bisected, | |regression CC| |[email protected] Regression By| |Tomaž Vajngerl --- Comment #2 from BogdanB <[email protected]> --- I bibisected the undo part. Undo is not complete, we have remaining references into the cells after this commit. Cells were clean before this commit. commit 3c95eed2bacf0c551b43d4564eb367d658c40372 Author: Tomaž Vajngerl <[email protected]> Date: Wed Jun 10 09:45:08 2026 +0900 sc: promote UI-typed array formulas to dynamic-array masters When the user types a formula that returns an array (UNIQUE, TRANSPOSE, a range plus a range, ...) and presses Enter, the cell now becomes a dynamic-array master. The array result spills into the empty cells to the right and below the typed cell. The user no longer has to press Ctrl+Shift+Enter to get array behaviour. Formulas loaded from a file and formulas created from a macro keep their old single-value behaviour, so existing documents are not affected. A new per-cell bit, mbAutoDynamicArrayEligible, marks a cell as allowed to promote. The view code sets it on freshly typed formulas. The importers and the macro entry path leave it off. When such a cell first calculates, the formula tokens are walked in execution order to ask the question: does this formula produce an array result? If yes, the cell switches to dynamic-array master mode before the calculation runs, so the array result is kept and the cells to the right and below get filled in. The walk tracks whether the value sitting on the stack at each step is an array or a scalar: - Pushing a multi-cell range or an inline matrix puts an array on the stack. - An operator like + or * keeps the result an array if any operand was an array. - A function known to return an array (UNIQUE, TRANSPOSE, MMULT, SEQUENCE, ...) puts an array on the stack. Other functions reduce to a scalar. - Branching functions like IF, CHOOSE, IFERROR and LET do not fit this simple model, so the walk gives up and the cell stays a plain single-cell formula. A formula that begins with the @ implicit-intersection operator (=@UNIQUE(...)) opts out of promotion. Cells that are part of a formula group share a single compiled formula and stay single-cell so the group is not broken. Ctrl+Shift+Enter still produces a classic static array master. The shortcut now routes straight to the matrix-entry code, so the auto-detect described above does not interfere. The formula compiler has an optimization that rewrites a multi-cell range as a single-cell pick when the formula sits in a single-cell context. For example =A1:A4 typed in row 2 becomes =A2 before evaluation. That is the long-standing implicit-intersection rule. For typed input the optimization has to be off, otherwise the multi-cell range disappears from the formula before the walk can see it. The optimization stays in place everywhere else, and the engine still applies implicit intersection at run time when the cell remains a plain single-cell formula. XLSX export XLSX marks a dynamic-array master with cm="1" on the cell. The exporter used to fall back to "matrix master plus a dynamic-array function" when the explicit flag was missing. The fallback is now removed. Every cell that should export as dynamic carries the flag explicitly, set by the importer or by the UI entry path. One trade-off: a Ctrl+Shift+Enter (CSE) array of a dynamic- array function imported from an XLSX file that has no cm="1" marker no longer round-trips as dynamic. The cell flag is now the single source of truth. Tests Tests cover the array-intent walk for =MINVERSE(...), ={1;2}, ={1;2}+3, ={1;2}+{3;4}, ={1;2}+A1, =ABS({-1;-2}), =A1:A2, =A2:A5+B2:B5, a long chain of binary additions over the same range, a range times a scalar, =IF(...) with array branches, and =SUM(...) over a range as the scalar case. Signed-off-by: Tomaž Vajngerl <[email protected]> Change-Id: Icb4b5e108634cd1529ac829cb34865c56ed8ec02 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4684 Tested-by: Jenkins CPCI <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit c3d67d3ec81621c385744fac7fd7a722084a122f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207219 Tested-by: Xisco Fauli <[email protected]> Reviewed-by: Xisco Fauli <[email protected]> -- You are receiving this mail because: You are the assignee for the bug.
