You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DataTable: Copy on a cell range copies only the active cell #4177
With a range of cells selected in DataTable, Copy puts only the range's active cell on the clipboard, not the cells of the range.
Environment
NSH: 0.8.0 (nsh-base 0.8.0 from crates.io)
Platform: macOS, desktop
How it runs: embedded in an app (Rust API), also under the headless test driver
Steps to Reproduce
A data_table with cell and range selection on, then:
Click a cell, Shift-click the cell one row down and one column right (a 2×2 range).
Press Cmd+C.
Paste somewhere.
Expected
Every cell of the range: a tab between cells and a line break between rows, in the displayed column order. That is the form selection_text already writes for a row (tabs) and a column (line breaks).
Actual
One cell. nsh-base-0.8.0/src/data_table/controller.rs, selection_text (lines 2033-2041):
Selection::Range(range) => {let active = range.active_cell();self.write_cell(active.rowasusize, active.columnasusize,&mut text);}
Related, from reading the source: on macOS the standard Copy menu role appears to reach text Copy rather than the table's (nsh-platform-macos-0.8.0/src/view.rs:966, src/text.rs:2863), so Edit > Copy with a table focused needs the app to handle the item itself.
The fix looks small (loop the range's rows and its columns in columns.order(), as the row and column arms do). Happy to send a pull request if that is welcome.
Thanks for the detailed report. This is fixed on main by #3955 (merged after 0.8.0): Copy (the shortcut and DataTableRef.copy() / DataTableApi::copy()) now writes the whole range as tab-separated rows, starting at the top-left cell and in displayed column order, with cells that contain tabs, line breaks or quotes quoted. It will ship in the next release.
#4183 adds Shift+arrow range extension (#4176) and tests that grow a range from the keyboard, including a reversed one and one across a fixed column, then check the copied text.
On the macOS menu point: you read it right. Cmd+C reaches the table, because NSH's key monitor matches the table's mod+c binding before AppKit's menu key equivalents. Choosing Edit > Copy with the mouse goes to the root view's copy:, which only copies text selections, so with a table focused it copies nothing. That is tracked separately; until then, an app that wants the menu item to copy a focused table can handle the item itself and call copy() on the table's ref.
🤖 Noop (rust-maintainer) · Opus 5.5 acting for @huacnlee
Activity
huacnlee commentedon Dec 3, 2026
Thanks for the detailed report. This is fixed on
mainby #3955 (merged after 0.8.0): Copy (the shortcut andDataTableRef.copy()/DataTableApi::copy()) now writes the whole range as tab-separated rows, starting at the top-left cell and in displayed column order, with cells that contain tabs, line breaks or quotes quoted. It will ship in the next release.#4183 adds Shift+arrow range extension (#4176) and tests that grow a range from the keyboard, including a reversed one and one across a fixed column, then check the copied text.
On the macOS menu point: you read it right. Cmd+C reaches the table, because NSH's key monitor matches the table's
mod+cbinding before AppKit's menu key equivalents. Choosing Edit > Copy with the mouse goes to the root view'scopy:, which only copies text selections, so with a table focused it copies nothing. That is tracked separately; until then, an app that wants the menu item to copy a focused table can handle the item itself and callcopy()on the table's ref.🤖 Noop (rust-maintainer) · Opus 5.5 acting for @huacnlee
desktop: Route Edit menu Copy to the focused view's key bindings (#4185)
data_table: Extend a cell range with Shift and the arrow keys (#4183)