Skip to content

feat(datagrid): choose the format Cmd+C copies rows in - #3718

Merged
datlechin merged 3 commits into
mainfrom
feat/2496-cmd-c-copy-format
Oct 20, 2026
Merged

datlechin merged 3 commits into
mainfrom
feat/2496-cmd-c-copy-format

Conversation

@datlechin

@datlechin datlechin commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Settings > Data > Copying: Copy rows as sets what Copy (Cmd+C) writes for whole rows: TSV (default), TSV with Headers, JSON, CSV, CSV with Headers, Markdown.
  • Applies in the table, query result, data file, agent result, table listing and server list grids. The Structure grids keep copying their own definitions.
  • A cell range still copies as cells and a clicked cell as its value.
  • A row picked by its row number copies as a row. It used to copy the first cell, where the row selection seeds the keyboard cursor.
  • Copy Cell Value in Edit > Copy Special and in the cell's right-click menu copies the focused (or clicked) cell, whatever else is selected.
  • Edit > Copy Special gains Copy as CSV, CSV with Headers, Markdown, IN Clause, INSERT Statements and UPDATE Statements. The focused grid answers them, as it does Set Value.
  • The seven new commands are unbound rows in Settings > Keyboard. ShortcutUniquenessTests pins the unbound count, now 29 (was 22).
  • JSON, CSV and Markdown row copies carry the grid's rows payload, as TSV with Headers already did. Cmd+V in a table or a data file pastes the rows, not the parsed text. A data file maps a copy of its own columns by name, and anything else in order.
  • Formatted row copies stop at the 50,000-row clipboard cap, text and payload alike.
  • Agent results and table listings now copy rows as TSV. Copy did nothing there.

Test plan

  • RowCopyFormatTests (new): with CSV with Headers, three selected rows copy as a header line and three CSV lines (fails on main, which writes TSV). Also covers a row picked by number, a focused cell, a cell range, a Structure-style grid, the right-click Copy, Copy Cell Value, the Copy Special commands, IN Clause columns, INSERT and UPDATE availability, data file paste, held rows and the row cap.
  • SettingsFieldDecodingTests: settings without the field, or with an unknown format, decode to TSV.
  • The grid copy, menu, shortcut, clipboard and data file suites pass.

Not in this PR

  • Edit > Copy Special > Copy with Headers and Copy as JSON run from the window (RowEditingCoordinator), not the grid. Over a cell selection they take every visible column, while the right-click Copy as takes the selected ones. Copy with Headers from the menu bar also writes no HTML.
  • Copy Rows and Copy as > Rows also take every visible column over a cell selection. The docs say a copy over a cell selection carries only those columns.
  • Copy Rows, Copy with Headers and Copy as JSON stay dimmed in data file windows: DataFileSplitViewController does not implement them.
  • The Compare and Create Table grids copy nothing for whole rows: their delegates keep the protocol's empty dataGridCopyRows.
  • KeyHandlingTableView.copyRowsAsTSV(_:) has had no menu item since refactor(coordinator): delete dead AppCommands subjects, PasteboardActionRouter, and unused selectors #1340. Only its tests call it.

Pairs with TableProApp/docs#75.

Fixes #2496

@datlechin
datlechin merged commit 1ec7fb2 into main Oct 20, 2026
9 checks passed
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.

Choose what Cmd+C copies in the data grid

1 participant