Repository navigation
feat(grid): select rows, and copy them in the formats people paste into (#416) - #633
Merged
Merged
Conversation
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
force-pushed
the
feat/results-selection-copy
branch
from
September 11, 2026 05:33
c155728 to
c63d06a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
nullrather than""— a distinction the database was keeping.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 = 1is 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