Repository navigation
Edit CSV tables directly and remember column widths - #25442
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe CSV table view now supports cell editing, selection, filtering, sorting, copying and pasting, and row and column operations. CSV mutations preserve eligible source formatting and enforce size and dimension limits. Column widths persist by file preference key. Editor save handling now flushes pending changes and accounts for pending edits when setting dirty state. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The delayed-paste test exercises a pending clipboard read and verifies that moving focus does not change either pane. No actionable current-head issue remains; routine checks can proceed. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2b249199-9fd4-477a-9b58-3732c3314586
📒 Files selected for processing (44)
src/renderer/src/components/editor/CsvColumnResizeHandle.tsxsrc/renderer/src/components/editor/CsvGrid.tsxsrc/renderer/src/components/editor/CsvGridCell.tsxsrc/renderer/src/components/editor/CsvPagedViewer.tsxsrc/renderer/src/components/editor/CsvTableToolbar.tsxsrc/renderer/src/components/editor/CsvViewer.editing.test.tsxsrc/renderer/src/components/editor/CsvViewer.tsxsrc/renderer/src/components/editor/EditorEditFileSurface.tsxsrc/renderer/src/components/editor/EditorViewToggle.tsxsrc/renderer/src/components/editor/csv-cell-clipboard.tssrc/renderer/src/components/editor/csv-cell-selection.tssrc/renderer/src/components/editor/csv-column-width-limits.tssrc/renderer/src/components/editor/csv-column-width-preferences.test.tssrc/renderer/src/components/editor/csv-column-width-preferences.tssrc/renderer/src/components/editor/csv-file-limits.tssrc/renderer/src/components/editor/csv-grid-interaction.tssrc/renderer/src/components/editor/csv-grid-keyboard.tssrc/renderer/src/components/editor/csv-inspection.tssrc/renderer/src/components/editor/csv-parse.tssrc/renderer/src/components/editor/csv-pending-save.test.tssrc/renderer/src/components/editor/csv-serialization.tssrc/renderer/src/components/editor/csv-source-record.tssrc/renderer/src/components/editor/csv-table-edit-budget.tssrc/renderer/src/components/editor/csv-table-interactions.test.tssrc/renderer/src/components/editor/csv-text-cell-edits.tssrc/renderer/src/components/editor/csv-text-document.test.tssrc/renderer/src/components/editor/csv-text-document.tssrc/renderer/src/components/editor/editor-csv-file-content.tssrc/renderer/src/components/editor/editor-pending-flush.test.tssrc/renderer/src/components/editor/editor-pending-flush.tssrc/renderer/src/components/editor/editor-save-queue.tssrc/renderer/src/components/editor/file-view-preference-storage.tssrc/renderer/src/components/editor/pdf-scale-preference-storage.tssrc/renderer/src/components/editor/use-editor-content-change-handler.test.tsxsrc/renderer/src/components/editor/use-editor-content-change-handler.tssrc/renderer/src/components/editor/useCsvClipboard.tssrc/renderer/src/components/editor/useCsvColumnWidths.tssrc/renderer/src/components/editor/useCsvPendingCell.tssrc/renderer/src/components/editor/useCsvTableEditor.tssrc/renderer/src/components/ui/textarea.tsxsrc/renderer/src/i18n/locales/en.jsontests/e2e/csv-paged-preview.spec.tstests/e2e/csv-table-editing.spec.tstests/e2e/csv-url-links.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
|
Review fixes are in
Validation: 184 focused tests, application typecheck, changed-code quality, formatting/lint, and eight hidden Electron tests pass. The screenshots show the active input after autosave; the test also checks the exact file contents before and after committing it. |
|
@coderabbitai review |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Cancel app-menu paste if focus leaves the grid. · useCsvClipboard.ts:56-75
src/renderer/src/components/editor/useCsvClipboard.ts:56-75
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winCancel app-menu paste if focus leaves the grid.
The app-menu handler checks the owner before
readClipboardText()awaits. If the user focuses another grid before the read resolves, the first grid’s revision stays unchanged andpasteText()can still apply the clipboard data to that grid. Recheck focus for app-menu paste only; keep toolbar and keyboard paste behavior unchanged.Suggested fix
- const paste = async (): Promise<void> => { + const paste = async (requireOwnerFocus = false): Promise<void> => { ... if (initialRevision !== revision.current) { throw new Error('CSV changed before paste completed. Try again.') } + if ( + requireOwnerFocus && + globalThis.document.activeElement?.getAttribute('data-csv-owner') !== ownerId + ) { + return + } pasteText(text) ... - void paste() + void paste(true)
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ab3a9baa-d167-4447-81f5-c8b3e726ab45
📒 Files selected for processing (13)
src/renderer/src/components/editor/CsvGrid.tsxsrc/renderer/src/components/editor/CsvGridCell.tsxsrc/renderer/src/components/editor/CsvViewer.editing.test.tsxsrc/renderer/src/components/editor/CsvViewer.tsxsrc/renderer/src/components/editor/csv-pending-save.test.tssrc/renderer/src/components/editor/csv-text-cell-edits.tssrc/renderer/src/components/editor/csv-text-document.tssrc/renderer/src/components/editor/editor-pending-flush.tssrc/renderer/src/components/editor/editor-save-queue.tssrc/renderer/src/components/editor/useCsvClipboard.tssrc/renderer/src/components/editor/useCsvPendingCell.tssrc/renderer/src/components/editor/useCsvTableEditor.tstests/e2e/csv-table-editing.spec.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/renderer/src/components/editor/csv-pending-save.test.ts
- src/renderer/src/components/editor/CsvGridCell.tsx
- tests/e2e/csv-table-editing.spec.ts
- src/renderer/src/components/editor/editor-pending-flush.ts
- src/renderer/src/components/editor/editor-save-queue.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
|
Fixed the outside-diff clipboard finding in App-menu paste now rechecks the initiating grid after the clipboard read. Toolbar and keyboard paste retain their behavior. The new two-pane regression verifies that moving focus while a read is pending does not change either file. All 18 CSV editing tests, application typecheck, and changed-code quality pass. @coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/editor/CsvViewer.editing.test.tsx (1)
310-312: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert that app-menu paste starts before focus moves.
If
readClipboardTextis never called, the pending promise does not paste anything, so both content-change assertions still pass. Spy on the read and assert one call after dispatch. This ensures the test checks cancellation of a paste that started before focus moved.Suggested test change
const pending = new Promise<string>((resolve) => { resolveRead = resolve }) + const read = vi.fn(() => pending) Object.defineProperty(window, 'api', { configurable: true, - value: { ui: { readClipboardText: () => pending } } + value: { ui: { readClipboardText: read } } }) ... act(() => { window.dispatchEvent(new Event(APP_MENU_PASTE_EVENT, { cancelable: true })) }) + expect(read).toHaveBeenCalledTimes(1) act(() => { screen.getAllByRole('grid')[1]?.focus() })
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2b7aab9f-b223-4dc4-a821-cd2fde8b7870
📒 Files selected for processing (2)
src/renderer/src/components/editor/CsvViewer.editing.test.tsxsrc/renderer/src/components/editor/useCsvClipboard.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Addressed the final test nit in 0015e52: the delayed app-menu paste regression now asserts that the clipboard read started before focus moved. All 18 CSV editing tests and the application typecheck pass. |
|

ELI5
CSV tables currently let you resize columns, but editing still requires switching to Source. This adds cell editing, row and column operations, range copy/paste, and sorting/filtering for inspection. Column widths now survive view switches and app restarts.
What Changed
Why
A plain-text CSV model lets the table preserve file formatting and source row identity while reusing the existing virtualized grid and file-owner save paths. The Markdown table uses rich-document positions and transactions, which do not fit these CSV operations. This extends the existing components without adding a dependency or changing remote file commands.
Linked Issue
Fixes #12915 for editable CSV/TSV files. Large-file editing remains deferred as requested; files at least 1 MiB continue to use read-only paged previews.
Thanks to @hungrytech for #13223. Their draggable separators, aligned header/body widths, and retention of manual widths across remounts were the right direction. This follow-up adds persistence by file owner and the remaining table operations.
Visual Proof
Same CSV fixture in hidden Electron. Before renders the merged viewer from
f873aaac5b25; after shows edited values and a sorted inspection view. The test separately asserts that saving retains the original file row order. Images are attachments, not repository files.Before
After
Testing
On macOS, 185 focused tests pass across 20 suites.
pnpm tc, changed-code quality, localization catalog/extraction/coverage checks, and the Electron E2E build pass. All agent-launched app windows remain hidden.Eight hidden Electron tests pass across
csv-table-editing.spec.ts,csv-paged-preview.spec.ts, andcsv-url-links.spec.ts: cell commit/cancel, Source/Table handoff, width retention, row/column mutations, column reordering, range clipboard events, sorted/filtered edits, exact saved bytes, clipped-cell typing, scrolling commits, autosave during typing, keyboard editing at the final cell of a 1,024-column table, bounded large previews, large-file save guards, and URL navigation. Unit regressions cover slow-save races, same-file panes, stale clipboard reads, failed saves, BOM/CRLF/ragged records, empty final records, and ambiguous delimiter guesses.The standalone
pnpm run typecheck:e2ecurrently reports errors in other specs and test tools; none of the changed CSV specs are reported. The application typecheck passes. Live SSH, Windows, and Linux were not exercised locally; editing uses their existing file-owner save path and platform-aware shortcuts.Review
Reviewed serialization, draft ownership, cancellation, asynchronous clipboard reads, remote-write timing, pane cleanup, and width persistence. Fixed a newer cell edit being marked clean by an earlier save, same-file pane registrations replacing one another, closed tabs recreating drafts on detach, Auto changing separators during edits, and deletion losing a retained empty record. The bot follow-up fixes autosave closing active inputs, browser caret scrolling closing clipped inputs, and structural edits discarding rejected pending input. Cell commits, Save, and table commands now share a single mutation path; structural serialization no longer has an unused budget bypass. Delayed clipboard reads also reject newly started typing, and app-menu paste is cancelled if the initiating grid loses focus. Existing large-preview memory and save-safety checks still pass.
Agent skill upstream boundary
Notes
Large previews remain read-only. Table edits must stay below 1 MiB; Source can retain larger drafts. Paste outside the existing table is rejected atomically, with an instruction to add rows or columns first. Column reordering uses the Columns menu. Sorting/filtering is an inspection view and never rewrites source row order.
Checklist