Show the selected range, not just the active cell, in status/formula bar

New store computed selectionRangeName: for a single cell it's identical
to activeCellName ("Umsatz::B2"), for a multi-cell selection it shows
the full primary rectangle ("Umsatz::B2:E6"), and a discontiguous
multi-selection gets a "+N" suffix for the further rectangles.
activeCellName itself is untouched (still anchor-only, since that's what
a formula/edit actually targets) -- only the formula bar's name field and
the status bar's range label switch to the new computed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
wkh
2026-09-02 15:49:35 +02:00
co-authored by Claude Sonnet 5
parent 85a8687020
commit 1046b22e96
5 changed files with 50 additions and 6 deletions
+23
View File
@@ -1412,6 +1412,28 @@ function createStore() {
return `${t?.name ?? '—'}::${toA1(cell.col, cell.row)}`;
});
/** Like {@link activeCellName}, but for a multi-cell selection it shows the
* full range (`Umsatz::B2:E6`) instead of just the anchor -- used wherever
* the UI shows "where am I" (formula bar, status bar), as opposed to
* `activeCellName`/`activeCell`, which stay anchor-only because that's
* what a formula/edit actually targets (see the "selection aggregate &
* cell name are live" test). A discontiguous multi-selection additionally
* gets a `+N` suffix for the further rectangles beyond the primary one. */
const selectionRangeName = computed(() => {
const sel = doc.selection;
const t = sel ? tableById(sel.tableId) : activeTable.value;
const tableName = t?.name ?? '—';
if (!sel) return `${tableName}::${toA1(0, 0)}`;
const rects = selectionRects(sel);
const [p] = rects;
const addr =
p.c0 === p.c1 && p.r0 === p.r1
? toA1(p.c0, p.r0)
: `${toA1(p.c0, p.r0)}:${toA1(p.c1, p.r1)}`;
const extra = rects.length > 1 ? ` +${rects.length - 1}` : '';
return `${tableName}::${addr}${extra}`;
});
const activeCellInput = computed(() => {
const sel = doc.selection;
return sel ? cellInput(sel.tableId, sel.anchor.col, sel.anchor.row) : '';
@@ -1606,6 +1628,7 @@ function createStore() {
selectionRects,
activeCell,
activeCellName,
selectionRangeName,
activeCellInput,
selectionAggregate,
// clipboard