diff --git a/src/components/TableGrid.vue b/src/components/TableGrid.vue index 2d4ba94..c03b1d3 100644 --- a/src/components/TableGrid.vue +++ b/src/components/TableGrid.vue @@ -720,7 +720,9 @@ function selectColumn(c: number, e?: MouseEvent) { const t = table.value; if (!t) return; clearFlow(); - const a = { col: c, row: 0 }; + // Shift extends from the current anchor's column to the clicked one + const from = e?.shiftKey && mine.value ? mine.value.anchor.col : c; + const a = { col: from, row: 0 }; const f = { col: c, row: t.rows - 1 }; if (e && (e.metaKey || e.ctrlKey)) store.addRangeToSelection(props.tableId, a, f); else store.setSelection({ tableId: props.tableId, anchor: a, focus: f }); @@ -730,7 +732,9 @@ function selectRow(r: number, e?: MouseEvent) { const t = table.value; if (!t) return; clearFlow(); - const a = { col: 0, row: r }; + // Shift extends from the current anchor's row to the clicked one + const from = e?.shiftKey && mine.value ? mine.value.anchor.row : r; + const a = { col: 0, row: from }; const f = { col: t.cols - 1, row: r }; if (e && (e.metaKey || e.ctrlKey)) store.addRangeToSelection(props.tableId, a, f); else store.setSelection({ tableId: props.tableId, anchor: a, focus: f });