Files
gridcraft/crates/engine
Aleksander HelgakerandClaude Opus 5.5 4d94d3e27c Data: paste or import clipboard text as columns (Get Data › From Clipboard…, Paste Data…) (#4839)
* feat(data): paste or import clipboard text as columns

Data › Get Data (Text/CSV) becomes a split button. Its menu adds
From Clipboard…, and the cell menu adds Paste Data… after Paste
Special…. Both open a dialog that asks for the separator (comma,
semicolon, tab, space or another character), starting on the one the
text uses. From Clipboard imports into a new sheet as a table, and
Paste Data pastes the columns at the clicked cell. The dialog imports
the text it read when it opened, and Paste Data names the sheet with
its cell.

- data.fromTextCsv: `at` pastes at a cell, Sheet!-qualified or on the
  active sheet. Without a delimiter, craft-csv's sniffer picks comma,
  semicolon or tab. JSON records are read only when no delimiter is
  given. The delimiter must be one character other than a quote or
  line break, up to U+00FF. The reader's cells are written with their
  number formats, so dates and percents keep them and formula-looking
  text stays text.
- data.fromClipboard (UI command): the same with the system clipboard.
- Key tips: Alt/F10, A, P, N opens the Get Data menu with G and C
  (APNC is new). Up/Down in a menu key tips opened moves focus onto
  its items, wrapping at the ends. Enter runs the focused item without
  also confirming what it opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(data): clipboard import review fixes and rustfmt

- Paste Data's destination is a "Paste at" reference box holding the
  selection's top-left cell, the cell Paste uses. As in the other
  dialogs with reference boxes, OK shows the dialog's own sheet again
  first, found by its uid, and is refused once that sheet is deleted.
- A paste at a cell covers every field of the text, trailing blank
  fields and records included, so they clear the cells under them.
  read_csv_with_report now reports the record count and the widest
  record.
- CSV dates are read as serials of the destination workbook's date
  system (1900 or 1904).
- The first arrow into a key-tip menu cancels the focus move egui had
  already queued, so it lands on the first item even when a ribbon
  button was focused.
- cargo fmt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(data): Paste Data refuses rows past the sheet and clears all-blank text

- read_csv_with_report reports `truncated` when the text has records
  past a sheet's last row. A paste at a cell refuses such text before
  writing anything, instead of dropping the rest. Text with exactly
  MAX_ROWS records still pastes.
- A paste at a cell uses the text's record extent even when it has no
  non-empty field, so text like `,` clears the cells it covers instead
  of failing as an empty file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(data): Paste Data refuses text wider than a sheet

The CSV reader keeps one field past MAX_COLS per record, so a wider
record can be told from one that fits, and reports it as `truncated`,
as it does records past the last row. A paste at a cell refuses such
text before writing anything; text exactly MAX_COLS fields wide still
pastes. Importing into a new sheet still keeps the first MAX_COLS
fields, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(data): read bracket-led text without a separator as delimited text

From Text/CSV, Get Data and From Clipboard read any text whose first
character is `[` as JSON when no separator was given, so delimited text
whose first field is bracketed (`[Draft];Oslo`) was rejected with a JSON
parse error. Text is now read as records only when it parses as a JSON
array of objects; anything else goes to the delimited reader, which picks
the separator by the text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 10:54:16 +01:00
..