Skip to content

Add header and serial index actions and keep context menus in view - #124

Closed
jonaraphael wants to merge 11 commits into
codex/fix-clipboard-fidelityfrom
codex/header-context-menu
Closed

jonaraphael wants to merge 11 commits into
codex/fix-clipboard-fidelityfrom
codex/header-context-menu

Conversation

@jonaraphael

@jonaraphael jonaraphael commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

CSV's per-file header and serial index preferences are only available through the Command Palette. Context menus now offer them where they apply:

  • Right-click a cell in the first visible row for Use first row as header or Treat first row as data. Later rows retain ordinary context actions without that toggle. Hidden leading metadata moves the eligible row; filtering does not promote an arbitrary matching row. The offset is clamped to the rendered first row when all source records are hidden.
  • Right-click a serial index cell, including an empty/append row or the top-left serial corner, for Hide serial index column. Ordinary data/header cells do not offer it. Restore the hidden column with the existing CSV: Toggle Serial Index Column command. The corner retains Select All on left-click and does not gain invalid sorting, row or column actions.

Both actions use the existing preference for the owning document and refresh that file's views without changing CSV text or saving. Messages validate boolean values; repeated serial-state requests are no-ops. The serial action maps a disappearing index/corner anchor to a surviving data cell in the same source row (corner: first visible row), preserving an existing valid data anchor. The live anchor is updated before persistence so later blur/refresh persistence cannot restore a missing serial cell. Scroll state is preserved. Header actions retain effective detected/explicit state, including empty files, and tag-independent anchor restoration when data becomes a header.

Menus measure their completed contents before opening. They use available viewport space to open left or upward when the right or bottom side cannot fit, then clamp within editor margins. Natural width is preserved when space permits; narrow or short panes wrap and scroll the menu so actions remain reachable. Placement uses viewport coordinates even when the table or document is scrolled. Viewport resize and actual CSV zoom changes dismiss an open menu; reopening measures it again. No settings, command contributions, palette or theme-color changes are added.

Depends on #111. Combined integration also uses the existing shared draft-safe refresh path from the editor-switch/untitled work. The shared clipboard path quotes each value only as required and omits the extra append row from all Copy/Cut routes, while preserving real empty source cells.

Validation:

  • Parent branches are synchronized. The update preserves every production and regression-test file; only README clipboard wording was aligned.
  • Node 20.20.0; compile and all 188 branch tests pass. Branch lint: zero errors and 87 existing warnings; diff checks pass.
  • Header regressions cover CSV/TSV header states, both first-row columns, omission on later rows, effective detected state, owner targeting, malformed messages, hidden metadata, empty/all-hidden files, unchanged source/version and anchor/scroll restoration.
  • Serial regressions execute provider HTML, the shipped webview and provider message handlers: CSV/TSV with headers on/off, body/append/corner targets, ordinary-cell omission, Select All preservation, boolean validation/idempotence, owner URI and multiple views, empty files, hidden metadata, remote chunks, repeated persistence, valid-data-anchor preservation, queued multiline edits, unchanged source/version/disk and the existing restoration path.
  • Popup regressions cover measured right/bottom thresholds and fractional coordinates, varying/completed menu sizes, all corners, client versus page coordinates, tiny-pane scrolling/actions, reopening, viewport resize and CSV zoom. No-op zoom reset keeps an open menu intact.
  • Independent source reviews cleared header, serial and popup paths. Combined integration 9c97e36 passes compile and 658/658 tests; lint has zero errors and 86 existing warnings. Integration tests cover the shared refresh ACK path, unposted/delayed/rejected drafts, retry/Escape, exact filtered source IDs and source formatting preservation.
  • Actual Chromium fixture checks passed readable right-edge left opening, bottom/corner placement, a scrollable 240px pane with reachable actions, resize/zoom dismissal and reopening. Serial checks passed target inclusion/omission, same-row focused data-anchor restoration, corner Select All (105/105 cells), restoration through the existing command path, retained scroll, headers off, an unsaved TSV edit, hidden metadata and filtered source IDs/counts.
  • Browser checks use generated provider HTML and shipped scripts with a mocked VS Code bridge, including other stacked menu actions. Native VS Code interaction for these new menus remains unverified; these fixtures are not a native extension-host smoke test.

First row, headers disabled:

Use first row as header

First row, headers enabled:

Treat first row as data

Later rows:

Ordinary context menu without header toggle

Right-edge placement in the combined browser fixture:

Context menu opens left at a readable width

Serial index context action in the combined browser fixture:

Hide serial index column

@jonaraphael jonaraphael changed the title Add first-row header toggle to every cell context menu Add context action for first-row header state Oct 17, 2026
@jonaraphael
jonaraphael marked this pull request as ready for review October 17, 2026 05:32
@jonaraphael
jonaraphael marked this pull request as draft October 17, 2026 06:52
@jonaraphael
jonaraphael marked this pull request as ready for review October 17, 2026 07:00
@jonaraphael
jonaraphael marked this pull request as draft October 17, 2026 07:11
@jonaraphael jonaraphael changed the title Add context action for first-row header state Add header and serial index actions and keep context menus in view Oct 17, 2026
@jonaraphael
jonaraphael marked this pull request as ready for review October 17, 2026 07:21
@jonaraphael
jonaraphael deleted the codex/header-context-menu branch October 17, 2026 21:13
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