Skip to content

feat(csv-gridsheet): auto-expand on paste/autofill, disable merged cells - #150

Merged
righ merged 7 commits into
masterfrom
righ/csv-merge-off-auto-expand
Oct 5, 2026
Merged

righ merged 7 commits into
masterfrom
righ/csv-merge-off-auto-expand

Conversation

@righ

@righ righ commented Oct 3, 2026

Copy link
Copy Markdown
Member

Stacked on #149 (needs the autoExpand option). Base is righ/feat-auto-expand; GitHub will retarget to master once #149 merges.

Summary

Auto-expand

  • New setting gridsheet.viewer.autoExpand — both (default) | vertical | horizontal | none — passed to the grid's autoExpand option. A paste or autofill past the last row/column adds the missing rows/columns instead of dropping the overflow; ghost rows/columns appear while dragging the fill handle; one undo reverts both.
  • Forced to none in read-only mode (the write is refused there anyway, so the grid shouldn't grow).
  • Trailing empty rows are still trimmed on save, so nothing changes for files that don't actually receive data in the new rows.

Merged cells disabled

  • feat: cell merge (engine model + rendering, selection, context menu) #148 added Merge / Unmerge to the default cell context menu, which the extension uses as-is — so they would appear on the next release without any change here.
  • CSV/TSV can't store a merge (lost on reopen), and merging clears every value but the anchor's, so a save would silently write those cells out blank.
  • Removed merge-cells / unmerge-cells (and their divider) from the context menu, and added operations.Merge to the default cell prevention in case another entry point appears. (Read-only already blocks it via ReadOnly.)

README settings list and CHANGELOG (Unreleased) updated. No version bump — the extension is released by hand.

Test plan

  • pnpm build for the extension (host + webview bundles)
  • Drove the built dist/webview.js in a browser harness (stubbed acquireVsCodeApi + a data message) with Playwright: the cell context menu shows Cut / Copy / Paste / Paste only value / Undo / Redo / Search — no Merge/Unmerge; copying A1:C3 and pasting at C3 on a 3×3 grid grows it to 5×5 (E5 = z)
  • Manual check in VS Code (Extension Development Host)

🤖 Generated with Claude Code

righ and others added 3 commits October 4, 2026 04:47
`options.autoExpand` ('none' | 'vertical' | 'horizontal' | 'both', default
'none') lets a paste or an autofill that runs past the last row/column append
the missing rows/columns instead of clipping them, capped by
limits.maxRows / maxCols.

- engine: Sheet.autoExpand; copy / copyAsync / move / writeRawCellMatrix and
  Autofill grow the sheet first. New BATCH history so the growth and the write
  undo/redo as one step; the growth is rolled back if the operation is refused
  (e.g. by a merge).
- react-core: while dragging the autofill handle, ghost rows/columns are
  rendered past the edge (as real table rows/cells, so sticky headers stay) so
  the drag can reach cells that don't exist yet. A paste that grew the sheet
  scrolls the pasted corner into view.
- fix: releasing an autofill drag over a ScrollHandle submitted the fill twice
  (two undo steps); StoreObserver's mouseup is now the only submitter.
- docs, storybook story (Restriction/AutoExpand), jest + e2e specs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@righ
righ force-pushed the righ/csv-merge-off-auto-expand branch from 25978d2 to dba0f16 Compare October 4, 2026 09:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@righ
righ force-pushed the righ/csv-merge-off-auto-expand branch from dba0f16 to 6d7b46b Compare October 4, 2026 17:42
The autoExpand ghost area is now drawn outside the grid — portaled to <body>,
positioned fixed right past the last row/column (only once that edge is
scrolled into view) — instead of as extra table rows inside the scroll area.
Cells in the fill target are highlighted; StoreObserver doesn't edge-scroll
while the pointer is over the ghost layer. Reverts the in-table ghost rendering
and the virtualize() "scrolled past the content" tweaks it needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@righ
righ force-pushed the righ/csv-merge-off-auto-expand branch from 6d7b46b to 076bbce Compare October 4, 2026 18:40
righ and others added 2 commits October 5, 2026 21:42
…autofill

Replaces the outside-the-sheet ghost layer with provisional ghost rows/columns
rendered inside the grid (as table rows/cells, so sticky headers stay):

- While the fill drag's pointer is past the grid content's edge (the whitespace
  of a larger box, or outside it) and the grid is scrolled to that edge, add one
  ghost row/col at a time, faster the further past the edge (200ms → 20ms).
- Ghosts are display-only (no sheet change, no history); releasing grows the
  sheet up to the reached row/col in one undo step, unreached ghosts vanish.
- The target follows the last ghost while past the edge, the grid stays pinned
  to that edge as it grows, and growth stops once the pointer is back over a
  cell. The edge ScrollHandle no longer snaps the target back to the last real
  row/col there.
- An autofill that grew the sheet scrolls the filled corner into view.
- Storybook AutoExpand story: limits raised to 1000 rows x 100 cols.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New setting gridsheet.viewer.autoExpand (both | vertical | horizontal | none,
  default both) passed to the grid's autoExpand option; forced off in read-only.
- Merge / Unmerge removed from the cell context menu and blocked via the Merge
  prevention: CSV/TSV can't store merges, and merging blanks the covered cells,
  which a save would then write out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@righ
righ force-pushed the righ/csv-merge-off-auto-expand branch from 076bbce to e66a2d3 Compare October 5, 2026 12:42
@righ
righ changed the base branch from righ/feat-auto-expand to master October 5, 2026 12:49
@righ
righ merged commit 0bd6948 into master Oct 5, 2026
3 checks passed
@righ
righ deleted the righ/csv-merge-off-auto-expand branch October 5, 2026 12:49
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.

1 participant