Skip to content

feat(grid): select rows, and copy them in the formats people paste into (#416) - #633

Merged
EVWorth merged 1 commit into
mainfrom
feat/results-selection-copy
Sep 11, 2026
Merged

EVWorth merged 1 commit into
mainfrom
feat/results-selection-copy

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #632.

FR-3.3. There was no selection at all — copying meant right-clicking one row, and "copy these four rows" had no expression. Copy produced tab-separated text and nothing else, so pasting a result into a ticket, a test fixture or a migration each meant reformatting it by hand.

Selection

The transitions every list in every operating system uses: click picks, Ctrl adds and removes, Shift extends from the anchor, Ctrl+Shift builds a second range, Ctrl+A takes everything.

The anchor is the part these usually get wrong — it stays where the last plain click landed, so moving a Shift+click resizes one range instead of leaving a trail of them. A plain click on the only selected row clears it, because otherwise getting back to nothing selected needs a menu.

Ctrl+A only fires while the grid holds focus. One meant for the editor must not quietly select four thousand rows behind it.

Copy formats

Six, all acting on the selection — or on the whole result when there is none, which is what "copy" with nothing picked has always meant. Each format's escaping is its own:

  • CSV quotes only what needs it and doubles an embedded quote, keeping a newline inside the quoted field as RFC 4180 allows.
  • TSV flattens tabs and newlines, since it has no escape for either and the row would come apart.
  • Markdown escapes pipes, which would otherwise start a new column.
  • JSON keeps NULL as null rather than "" — a distinction the database was keeping.
  • Bytes render as a hex literal rather than a list of numbers.

INSERT and UPDATE refuse rather than produce something broken. Both need a table to name, which a join doesn't have. UPDATE additionally needs a key to match on — without one every statement would rewrite the whole table — and it leaves the key out of the SET list, because SET id = 1 WHERE id = 1 is noise at best and on an auto-increment is a statement that reassigns the key to itself. The key is the real one, from the schema (#387).

The old single-row "Copy as INSERT" folds into the list; its #409 behaviour — naming the table that exists, refusing on a join — is kept and still tested.

Verification

2409 unit + 340 browser tests. 17 new tests on the selection transitions, 18 on the formats, 9 browser tests driving real clicks and the real menu.

Closes #416

🤖 Generated with Claude Code

@EVWorth
EVWorth changed the base branch from feat/results-blob-viewer to main September 11, 2026 05:16
FR-3.3. There was no selection at all — copying meant right-clicking one row,
and "copy these four rows" had no expression. Copy produced tab-separated text
and nothing else, so pasting a result into a ticket, a test fixture or a
migration each meant reformatting it by hand (#416).

Selection uses the transitions every list in every operating system uses:
click picks, Ctrl adds and removes, Shift extends from the anchor, Ctrl+Shift
builds a second range, and Ctrl+A takes everything. The anchor is the part
these usually get wrong — it stays where the last plain click landed, so
moving a Shift+click resizes one range instead of leaving a trail of them. A
plain click on the only selected row clears it, because otherwise getting back
to nothing selected needs a menu.

Ctrl+A only fires while the grid holds focus. One meant for the editor must
not quietly select four thousand rows behind it.

Six formats, all acting on the selection — or on the whole result when there
is none, which is what "copy" with nothing picked has always meant. Each
format's escaping is its own:

- CSV quotes only what needs it and doubles an embedded quote, keeping a
  newline inside the quoted field as RFC 4180 allows.
- TSV flattens tabs and newlines, since it has no escape for either and the
  row would come apart.
- Markdown escapes pipes, which would otherwise start a new column.
- JSON keeps NULL as null rather than "", a distinction the database was
  keeping.
- Bytes render as a hex literal rather than a list of numbers.

INSERT and UPDATE refuse rather than produce something broken. Both need a
table to name, which a join does not have. UPDATE additionally needs a key to
match on — without one every statement would rewrite the whole table — and it
leaves the key out of the SET list, because `SET id = 1 WHERE id = 1` is noise
at best and on an auto-increment is a statement that reassigns the key to
itself. The key is the real one, from the schema (#387).

The old single-row "Copy as INSERT" folds into the list; its #409 behaviour —
naming the table that exists, refusing on a join — is kept and still tested.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth force-pushed the feat/results-selection-copy branch from c155728 to c63d06a Compare September 11, 2026 05:33
@EVWorth
EVWorth merged commit c02fb08 into main Sep 11, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/results-selection-copy branch September 11, 2026 05:37
@EVWorth EVWorth mentioned this pull request Sep 11, 2026
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] [doc-drift] FR-3.3 selection & copy — multi-select + UPDATE/JSON/MD missing

1 participant