Skip to content

Select rectangular cell ranges in tables and keep cross-cell edits from breaking table structure #117

Open

Description

@BinaryOutlook

User need

People who edit tables in the visual editor expect the cell-range selection of modern spreadsheet and office editors: drag from one cell to another and get exactly that rectangle. For example, dragging from A2 down to A3 should select those two cells only, ready to copy, clear or extend.

Current behavior

In 0.5.2, a drag across table cells uses the browser's single text selection, which runs in reading order. Dragging from A2 down to A4 in a three-column table selects A2, B2, C2, A3, B3, C3 and part of A4. A rectangle cannot be selected.

The same selection can damage table structure. In the built editor, with the 3×3 body table A2…C4:

  • Dragging from A2 to A4 and pressing Cut removes row 3 and saves row 2 as a one-cell row (| |).
  • The same drag followed by Backspace merges rows 2 and 3 into one row and saves a literal <br> in a cell.

Related limits:

  • Shift+Up and Shift+Down inside a cell are left to the browser's text selection.
  • Pasting a copied spreadsheet grid into a cell inserts all of it as text in that one cell.
  • Table toolbar actions act only on the active cell.

Proposed behavior

Use the hybrid model of Google Docs, Word and Notion rather than Excel's click-selects-cell model, so that typing in tables keeps working as it does now:

  • A click in a cell places the caret, and a drag inside one cell selects text, as today.
  • A drag that leaves its starting cell switches to a rectangular cell range. Dragging back into the starting cell returns to text selection.
  • Shift+click extends a range from the active cell.
  • Escape, a plain click or an unmodified arrow key returns to a caret.

A new setting, binary-markdown.tableSelectionMode, controls this behavior. cells is the default; text keeps the browser's reading-order selection. The setting is also available in desktop Preferences.

Cell ranges are presentation state. Selecting, extending and clearing a range must not edit Markdown, mark the document dirty or add an undo step. GFM tables have no merged cells, so every range is a clean rectangle and table serialization does not change.

Scope

Slice 1: range selection and range operations

  • Pointer drag and Shift+click create a range in the same table, and the selected cells are highlighted with readable contrast in every theme.
  • The coordinate chip shows the range, such as A2:A3. The row and column gutter labels mark every row and column in the range.
  • Screen readers hear the range and its cell count.
  • Copy writes an HTML table to text/html and tab-separated rows to text/plain, so spreadsheets, office editors and plain-text editors all receive a grid.
  • Delete and Backspace clear the range's cell contents and keep every row and column. Cut copies the range and then clears it. Each is one undo step.
  • Typing while a range is selected collapses it to a caret at the end of the top-left cell and inserts the character there, without erasing other cells.
  • Cut, Delete and Backspace on a reading-order selection that spans cells of one table clear the touched cells instead of removing rows or cells. This protection applies in both selection modes.
  • Add the setting to VS Code Settings, desktop Preferences and every supported translation.

Slice 2: keyboard extension and whole-table selection

  • Shift+Arrow at the edge of a cell's text, or while a range is active, extends the range by one cell. Shift+Tab and Tab keep their cell-navigation behavior.
  • Pressing Cmd+A/Ctrl+A in a cell selects its contents, as now. Pressing it again selects the whole table as a range.

Later

  • Paste a copied grid (HTML table or tab-separated text) into a range, with a defined policy for grids larger than the table.
  • Range-aware toolbar actions, such as deleting several rows or columns and aligning several columns.
  • Selecting a whole row or column from its gutter label. This conflicts with the labels' current navigation behavior and needs a design decision.

Acceptance criteria

  • Dragging from A2 to A3 highlights exactly those two cells, with no native text highlight in other cells.
  • A drag inside one cell, double-click and triple-click keep their current text-selection behavior.
  • Shift+click, Shift+Arrow and the second Cmd+A/Ctrl+A create the expected rectangles. Escape, plain clicks and unmodified arrows collapse them.
  • Copying a range produces an HTML table and tab-separated text that match the selected cells.
  • Delete, Backspace and Cut clear exactly the selected cells, preserve the table's row and column counts, and are undone in one step.
  • Cut, Delete and Backspace never remove table rows or cells or write a literal <br>, in either selection mode.
  • Selecting, extending and collapsing a range does not change the Markdown, mark the document dirty or add an undo step.
  • Switching to Source or Split view, switching themes and external document updates clear a stale range without errors.
  • text mode reproduces today's selection behavior. Changing the setting applies to open editors without reloading.
  • Range highlights meet the existing selection-contrast checks in all themes, and the range is announced to assistive technology.
  • The editor guide documents the behavior and the setting, and translations stay in sync.

Priority: medium-high. The structure damage in the current behavior is a data-integrity bug, and range selection is a common expectation for table editing. This request does not set a release target.

Activity

  1. added
    bug
    enhancement
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions