RFC 0079 — Many cells at once: a block pasted, filled down and undone
Status: implemented (2026-11-30) · Target: 0.65.0 · builds on RFC 0078, RFC 0066 and RFC 0039 · see Decisions
Summary
RFC 0078 made a table a grid: one cell edited where it is, with a spreadsheet's keys. It left out what a spreadsheet's user does next: paste a column of prices from the supplier's sheet, give twenty rows the same status, and take a mistake back. Each of these writes many cells at once, which is what this RFC adds.
<Table
page={list}
bind:query
columns={[
"name",
{ key: "status", edit: { options: [["open", "Open"], ["paid", "Paid"]] } },
{ key: "price", align: "end", edit: "number" },
]}
oneditrow={(row, values) => api.products_update(row.id, { ...inputOf(row), ...values })}
/>
- A range of cells: Shift with the arrows, or a Shift-click, marks a block of cells from the focused one. ⌘C copies the block, and Delete empties it.
- Paste: ⌘V on a cell puts a block from the clipboard (from a spreadsheet, or from this table) into the cells from there, right and down. One value pasted on a range fills the range.
- Fill down: ⌘D gives the cells of a range the values of its top row.
- Undo: ⌘Z takes back the table's last change (an edit, a paste, a fill, an emptied range), and ⇧⌘Z does it again.
- The write of many: a row's changes are one write.
oneditrow(row, values)takes them, andoneditis still enough without it. A big write shows its progress and can be cancelled.
Motivation
- Data comes from spreadsheets. A price list, the hours of a week, a stock count: they arrive as a sheet, and are pasted into the app. Today that's one cell at a time, or an import the app has to write.
- The same value for many rows is the most common bulk change in a list: a status, a date, an owner. In a grid, it's a fill.
- A change in a grid is cheap to make, so it must be cheap to take back. A wrong paste over forty prices, with no undo, is forty edits by hand. RFC 0078 deferred paste and fill until undo came with them.
- The pieces exist. The grid and its cursor, the editors' kinds and
valueOf(RFC 0078), the pending dot and the overlay of written values (RFC 0039, RFC 0078), the tab-separated text the table copies (RFC 0066), and the progress with Cancel (RFC 0073).
Current state (0.67)
- With an editable column and
onedit, the table is agrid. One cell has the focus (the cursor). Enter, F2 or typing edits it, Delete empties it, and Space toggles a boolean. onedit(row, key, value)writes one cell. The row it gets has the values written before and not yet in the page. The cell shows the new value at once, with the pending dot. A failure takes it back; aValidationErrorfor the field reopens the cell with the message.- ⌘C on a cell copies its row, or the selected rows, as tab-separated text without a header (RFC 0066).
- ⌘Z isn't the table's. In a cell's editor it's the input's own undo. The menu's system Undo drives the webview's undo, which knows nothing of the table.
make:resource --inlinewritesoneditthrough{p}_update, which takes the whole input.
Design
A range
Shift with an arrow, Home or End marks
a block from the cell where it started (the anchor) to the cursor. So
does a Shift-click. The block is over the rows and columns as
they're shown (the user's order, the pinned ones first), within the
page. Its cells have aria-selected="true", and the table says the
size: "3 rows, 2 columns selected".
- A move without Shift, a click, or Esc ends the range. So does a change of the page, the sort or the filters.
- A range isn't the rows' selection. The checkboxes still select rows,
and the selection bar and
bulkare as they were. - ⌘C on a range copies its cells, as the table copies rows (each column's plain value, tab-separated). Without a range, ⌘C copies the row, as today.
- Delete or Backspace on a range empties its editable cells. A cell that can't be empty (a boolean) is left.
Paste
⌘V (Ctrl+V) on a cell, with no editor open, reads
the clipboard's text from the paste event, so no permission is asked.
- The block: lines split on line breaks, and cells on tabs, as spreadsheets copy them. A cell in quotes (a spreadsheet's way with a line break or a tab in a value) is read as one value. A last empty line is dropped.
- Where it goes: from the cursor's cell, right and down, over the columns as they're shown. With a range, from its top-left cell. One value pasted on a range goes into every cell of the range. A block pasted on a range that is a whole number of blocks fills it, as a spreadsheet does. Rows past the page's last aren't made (a new row isn't in this RFC), and they are said: "3 rows didn't fit".
- What it becomes: each value is read by its column's kind, as a
typed value is (
valueOf). Beyond what RFC 0078 reads, the paste also takes an option by its label as well as its value, and a boolean fromtrue/false,yes/no,1/0,xand an empty cell, and the app's words for yes and no. - What's skipped: a cell whose column has no
edit, or whose row isn'teditable, keeps its value, and the paste says how many were left: "Pasted 38 cells. 2 can't be changed." - A value that doesn't read (text in a number column, a date that isn't one): nothing is written. The cursor goes to the first such cell, and the message says which: "Row 4, Price: not a number." A paste is all of it or none of it, so the user never has to find which half went in.
Fill down
⌘D (Ctrl+D) on a range of more than one row gives each editable cell of the range its column's value from the range's top row. On a single cell, it takes the value from the cell above, as a spreadsheet does. Cells that can't be changed are left and counted, as in a paste.
The write of many
A paste, a fill or an emptied range is a list of changes: a row, a column and a value for each cell. The table writes them like this:
- One write per row. The changes of a row are grouped. With
oneditrow(row, values), the row is one call with every key that changed. With onlyonedit, it's one call per cell, one after another for the same row, so a command that takes the whole input always gets the row with the values written before. - Rows at once: up to four rows are written at the same time.
- At once on screen: every cell shows its new value as the write starts, with the pending dot on its row, as for one edit. The foot's totals and the group subtotals follow over a plain array.
- Progress: with more than 20 rows, the table's progress shows "Saving 12 of 40 rows…" with Cancel and Esc (RFC 0073's). Cancel stops the rows not yet sent. The ones written stay, and are the step that ⌘Z takes back.
- Failures: a row whose write fails has its values taken back. Its
cells are marked (
aria-invalid), with the message (aValidationError's for the field, else the error's) as their description until they are changed or the step is undone. The cursor goes to the first one, and one toast says it: "Couldn't save 3 of 40 rows." The rows that were written stay written. - One edit goes through
oneditrowtoo when the app gives it, with one key.
Undo
The table keeps a history of its own changes, as steps: an edit, a paste, a fill, an emptied range. Each step has, per cell, the value before and the value written.
- ⌘Z (Ctrl+Z) on the grid writes the values before back, through the same write of many, as one step. The cursor goes to the step's first cell, and its cells are the range. The table says "Undid paste of 38 cells".
- ⇧⌘Z (Ctrl+Y, Ctrl+Shift+Z) writes them again. A new change after an undo clears what could be redone.
- Only what's still as the step left it is undone. A cell whose value in the page isn't the step's value anymore (someone else changed it, or the live query brought a value the server changed) is left as it is: "Undid 36 cells. 2 were changed since, and are left." A row that isn't in the table now (a filter or a page away) is left the same way.
- What's kept: the last 50 steps, in memory, per table. They are gone when the table is. A failed write isn't a step. A step written only in part is the part that was written.
- In a cell's editor, ⌘Z is still the input's own.
- The app's menu. An app whose Edit menu has the system's Undo
keeps it: the grid's key handler sees ⌘Z first and takes it
when the grid has the focus, as ⌘C does (RFC 0066). The
table also exports
undo(),redo(),canUndoandcanRedofor an app that draws its own Undo items, which RFC 0055's menus can enable from them.
Words
rangeSize(rows, columns), pasted(n), cantChange(n),
didntFit(rows), pasteRefused(row, column, why), filled(n),
saving(done, total), savedSome(failed, total), undid(what, n),
redid(what, n), changedSince(n), nothingToUndo, in words.js and
en/nb. The table's messages are said through its live region, as
the selection's are.
make:resource --inline
The index view writes oneditrow instead of onedit:
api.{p}_update(row.{pk}, { ...inputOf(row), ...values }), so a pasted
row is one update, validated once. Nothing else changes.
Implementation plan
ui/src/internal/edit.js: a range's cells from anchor and cursor, the clipboard's block (blockOf(text), quotes and all), where a block goes (placed(block, at, range, rows, columns)), the paste's reading of each kind, fill down, and the changes grouped by row.ui/src/internal/history.js: the steps, undo and redo, and which cells are still as a step left them.Table.svelte: the range (keys, Shift-click, its marks), ⌘C on a range, Delete on a range, thepasteevent, ⌘D, ⌘Z/⇧⌘Z, the write of many with its progress and Cancel, failures on cells,oneditrow, andundo/redo/canUndo/canRedo.- Words, in
words.jsanden/nb. rata make:resource --inline:oneditrow, and its test and smoke.- Tests: a range by keys and by click, its copy and its emptying; a
paste from a spreadsheet's text, with quotes, one value on a range, a
block repeated on a range, rows that don't fit, cells skipped, a value
that doesn't read; fill down on a range and on one cell; one write per
row with
oneditrow, one at a time per row withonedit, four rows at once, progress and Cancel; a failed row, aValidationError; undo, redo, a cell changed since, a row no longer in the table, the limit of 50; and ⌘Z in an editor still being the input's. - Docs:
table.md("Many cells at once"), the keyboard table, a gallery example, the skills,resources.md, CHANGELOG.
Open questions
- A paste with a value that doesn't read: all or none? Recommendation: none. Spreadsheets paste what they can, but they don't write to a server, and a half-written paste over a list the user then has to check row by row is worse than one message about the first bad cell.
- Undo of a cell someone else changed since? Recommendation: leave it, and say how many were left. Writing the old value back over someone else's change would undo their work, not the user's.
- Keep the history when the page, sort or filters change? Recommendation: yes, while the table is there. A step is undone by the row's key, and rows that aren't in the table now are left and counted. A history that went away on a sort would surprise the user who sorted to check what they pasted.
oneditrowor a list of all the changes at once? Recommendation: per row. An app's update command is per record, and a write per row lets the table show progress, cancel, and fail one row without the others. An app with a bulk command can still batch behindoneditrow.- Fill right (⌘R), and a value for every selected row from the selection bar? Recommendation: not in this RFC. Fill right across columns of different kinds is rarely what's meant. Setting a column for the rows selected (every match, RFC 0077, across pages) is the next step after this one, and would use this write of many.
Decisions
Accepted 2026-11-30, with the open questions' recommendations:
- A paste is all of it or none of it. A value that doesn't read writes nothing, and the cursor goes to the first such cell with the message.
- A cell changed since isn't undone. It's left, and counted.
- The history stays while the table is there, through a change of page, sort or filters. Rows not in the table now are left and counted.
oneditrow(row, values), one write per row, with progress, Cancel, and a failure that is the row's own.- Fill right and a value for every selected row come later, the second on this write of many.
As built
As designed, with these differences:
- Paste has a second way in. The
pasteevent brings the text, as designed. Where a webview sends nopasteevent to a cell that isn't editable, ⌘V on a cell reads the clipboard itself after 100 ms: the shell's (clipboard.readText(), no question asked), else the browser's. Whichever comes first pastes. A second one finds the values already there and writes nothing. - The words are shorter. The table says "Undid 38 cells", not what kind of change it was, and a range's size is "6 cells selected (3 × 2)".
canUndo()andcanRedo()are functions, as the table's other exports are, for an app's menu to call when it enables its items.- Ctrl+Y redoes on Windows and Linux, except in a table with
previewandselect, where it's Quick Look (RFC 0041). Ctrl+Shift+Z redoes there too. - One edit that fails is as RFC 0078 has it: the editor opens again with a field's message, or a toast says why. The marks on cells, the cursor on the first and Couldn't save 3 of 40 rows are for a write of more than one row.
- Numbers read more ways, typed or pasted:
1,234.5and1.234,5as well as1 234,5. With both signs, the last is the decimal one.
Not in this RFC
- A new row typed at the end of the table, or rows made by a paste that's longer than the page.
- Fill right, fill by a series (1, 2, 3…), and dragging a fill handle.
- Setting a column's value for every selected row from the selection bar.
- An undo that lasts after the window closes, or across tables.
- A column of a related record (
belongs_to) pasted by its name.
Alternatives considered
- Paste through
navigator.clipboard.readText(). It asks for a permission in a browser, and on macOS shows a Paste button first. Thepasteevent has the text with no question, and is what the key already sends. - Undo by the webview's own undo. It knows inputs, not a table's writes to a server. The table's steps are what was written, and they are written back the same way.
- One call with every change (
oneditmany(changes)). One request, but no progress, no cancel, and a failure of one row is a failure of all of them, or a partial answer each app would have to shape. - Paste what reads, skip what doesn't. See open question 1.