Skip to content

fix(datagrid): copy only visible columns in their current order (#1354)#1372

Merged
datlechin merged 2 commits into
mainfrom
fix/1354-copy-visible-columns
May 21, 2026
Merged

fix(datagrid): copy only visible columns in their current order (#1354)#1372
datlechin merged 2 commits into
mainfrom
fix/1354-copy-visible-columns

Conversation

@datlechin

Copy link
Copy Markdown
Member

Fixes #1354.

Problem

Copying rows from the data grid always emitted every column from the underlying result, ignoring which columns are hidden and the order the user arranged them in. The clipboard output didn't match what's on screen.

Fix

Add a small VisibleColumnProjection value type that maps a result's columns, column types, and cell values down to the visible set, in display order. indices == nil is the identity (all columns), and out-of-range indices are dropped (or treated as NULL for values), so it's safe against stale layouts.

TableViewCoordinator.visibleColumnDataIndices() returns the data indices of the currently visible columns (excludes hidden columns and the row-number column) in their on-screen order. Every copy path runs through the projection:

  • TSV, with and without headers
  • CSV, Markdown, JSON
  • SQL INSERT / UPDATE
  • single-cell drag/copy (TSV + HTML)

Tests

  • VisibleColumnProjectionTests covers identity, reordering, hidden-column dropping, and out-of-range handling.
  • RowOperationsManagerCopyTests gains cases for copying with a visible-column subset.

Notes

The diff also adds .analysis/ to .gitignore (local-only issue-analysis dir).

@datlechin datlechin merged commit b4bdb81 into main May 21, 2026
2 checks passed
@datlechin datlechin deleted the fix/1354-copy-visible-columns branch May 21, 2026 12:29
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.

Copy includes hidden columns; should copy only visible columns

1 participant