fix(datagrid): apply Copy as and Delete to the whole cell-range selection#1898
Merged
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
datlechin
added a commit
that referenced
this pull request
Jul 16, 2026
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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.
Problem
After a cell-range drag in the data grid, right-click > Copy as > any format copied only the active row. The rest of the range was ignored. Same bug in the context menu's Delete and the Edit menu's Copy Rows, Copy with Headers, Copy as JSON, and Delete. Cmd-clicking a column header was worse: it empties the native row selection, so those commands saw no selection at all.
Root cause
The grid keeps two selection models: the native row selection (
GridSelectionState/NSTableView.selectedRowIndexes) and the cell-range selection (GridSelectionController, added in #1446). A range drag collapses the row selection to the active row on purpose, so anything reading only the row selection sees one row. Plain Copy and keyboard Delete were fixed in 0.51.1; every other action kept re-deriving the selection by hand from the row selection alone.Fix
TableViewCoordinator.currentRowSelection(fallbackRow:): range selection rows first, else the row selection, else the clicked row. This matches the AppKit contract (clickedRowinside the selection acts on all selected rows) and what DataGrip, TablePlus, Postico, and Sequel Ace do.KeyHandlingTableView, and the Edit menu commands inMainContentCommandActions(with the old behavior as fallback when no grid is mounted). The Structure tab and the row inspector inherit the fix through the shared grid code.DisplayRowMappinglike its siblings.Tests
17 new regression tests: every Copy as format and Delete driven with the exact post-drag state (range selection live, row selection collapsed to one row), the column-selection case, menu validation, display-order mapping for Copy as JSON, and the no-grid fallback.
Note:
CommandActionsDispatchTests/insertQueryFromAI_appendsToExistingfails on this branch and on clean main. It expects the append behavior that #1428 replaced with open-in-new-tab. Left for a separate fix.