## Overview
Part **1 of 8** in a series adding full keyboard/mouse navigation, cell
selection, multi-format clipboard copying, and keyboard-driven
sorting/filtering to `tabular_data_preview`.
Split into small, isolated PRs for review safety. The feature is gated
to debug/test builds (`cfg!(any(test, debug_assertions))`) until PR 6
(copying + context menus) to avoid exposing selection without copy
support.
---
### Full Series Roadmap
**1/8 (This PR):** Single-cell focus & arrow navigation with viewport
reveal
**2/8:** Range selection (`Shift+Arrows`), edge jumps
(`Cmd/Ctrl+Arrows`, `Home/End`), and page jumps (`PageUp/Down`)
**3/8:** Mouse selection, Shift+Click extension, and drag-to-select
**4/8:** Select All (`Cmd/Ctrl+A`) across datasets
**5/8:** Multi-format copy engine (TSV, CSV, Markdown, JSON Lines) &
`CopySelected`
**6/8:** Context menu, copy format settings, toasts, and release
enablement
**7/8:** Row selection via row gutter click/drag
**8/8:** Keyboard sorting (`Alt+S`), filter popover (`Alt+F`), and
filter clear (`Cmd/Ctrl+Alt+Backspace`)
NOTE, that all work is done & running on my machine end to end. The
split is just code review organization buerocracy.
<summary>
👇 Demo of fully ready feature👇
</summary>
<details>
https://github.com/user-attachments/assets/696554f9-ca3e-4b74-83d1-948292668334https://github.com/user-attachments/assets/5ef5f1f1-4f15-4b01-b825-de592d8a1972https://github.com/user-attachments/assets/40c0e57f-da7a-440a-9ee6-48af8abe116e
</details>
---
### Changes in this PR (1/8)
1. **Data-Space Coordinates (`CellSelection`):** Coordinates anchor to
`DataCellId { row: DataRow, col: AnyColumn }` so selection survives
background sorting/filtering without shifting rows.
2. **Single-Cell Navigation (`tabular_data::MoveFocusedCell`):** Arrow
navigation (`Up`/`Down`/`Left`/`Right`), initializing focus at `(0, 0)`
on first movement.
3. **Viewport Auto-Scroll & Peek Cushion:** Auto-scrolls focused cells
with a 20px horizontal peek buffer and 1-row vertical context cushion.
4. **Focus & Outline:** Renders focused cell border
(`theme.colors().border_focused`) and binds `"context": "TableView"`.
5. **Debug Gating:** Hidden in release builds via
`is_selection_enabled()` until copying lands in PR 6.
---
Release Notes:
- N/A
---------
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
## Objective
Extend the existing tabular preview to support `.jsonl` and `.ndjson`
files, making it easier to compare fields across records.
Discussed in https://github.com/zed-industries/zed/discussions/62917.
## Solution
Parse each nonblank line as a JSON object and reuse the existing table
preview. Top-level keys become columns in first-seen order, with new
keys from later records appended to the right.
- Preserve JSON values, including large numbers, without numeric
conversion.
- Display nested objects and arrays as compact JSON.
- Keep missing fields, `null`, `"null"`, and empty strings distinct.
- Show invalid-record errors with source line numbers and recover after
edits.
- Preserve sorting and filters unless column names or order change.
- Add JSONL/NDJSON to the existing preview shortcuts and document the
behavior.
Also fix a crash found during CSV regression testing: deleting rows
could leave the renderer using an old row mapping against shorter data.
Clear the mapping and virtual list together before recomputing them.
The preview remains read-only, accepts object records only, and uses the
existing text-based sorting and full-file parsing behavior.
## Testing
- All 20 tests in `tabular_data_preview` passed.
- The multiline CSV deletion regression passed across 20 scheduler
seeds.
- `cargo fmt -p tabular_data_preview -- --check` passed.
- `./script/clippy -p tabular_data_preview` passed.
- `cargo build -p zed --bin zed` passed.
- `git diff --check` passed.
- Manual QA on macOS, including retesting the reported CSV crash.
Windows and Linux were not tested locally. Large-file performance has
not been benchmarked.
To try it, open a `.jsonl` or `.ndjson` file and run `tabular data: open
preview` or `tabular data: open preview to the side`.
## Self-Review Checklist
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
## Showcase
<img width="2358" height="1576" alt="image"
src="https://github.com/user-attachments/assets/8f7e7725-5a5c-465d-aa0a-d61cbb22d04f"
/>
The example shows source-order columns, fields introduced by later
records, nested values, and the distinction between missing values,
nulls, and strings.
Release Notes:
- Added JSONL and NDJSON support to the tabular data preview.
---------
Co-authored-by: Anthony Eid <anthony@zed.dev>
# Objective
#62768 renamed `crates/csv_preview` to `crates/tabular_data_preview`,
but left the CSV-specific names inside it untouched (on purpose, to
reduce prev PR scope & git diff noise)
## Solution
Finished the generalization, one mechanical rename per commit for easier
review:
1. `CsvPreviewView` -> `TabularDataPreviewPane`
2. `CsvPreviewSettings` -> `TabularDataPreviewSettings`
3. Methods/vars
4. Test helpers/fn names
5. User-facing strings and element ids: tab title fallback:
- `"CSV Preview"` -> `"Tabular Data Preview"`,
- empty state `"No CSV content to display"` -> `"No data to display"`,
- dev tooltip, and element ids
`csv-filter-*`/`csv-col-header-*`/`csv-table`/`csv-display-cell-*` ->
`table-*`/`tabular-data-table`
6. Doc comments that implied CSV-only behavior, reworded to be
format-agnostic
> NOTE: PR is split into commits by change type for ease of review)
## Testing
`cargo check -p tabular_data_preview -p zed` builds clean after each
commit; `cargo test -p tabular_data_preview --lib` passes (10/10).
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
# Objective
#60768 renamed the feature (action names, icon, TSV/PSV/SSV support)
from CSV-only to generic tabular data preview, but left the crate itself
named `csv_preview` — no longer accurate now that it handles any
delimited format.
## Solution
Renamed `crates/csv_preview` to `crates/tabular_data_preview` and
updated all references (workspace `Cargo.toml` members/dependencies,
`crates/zed/Cargo.toml`, `crates/zed/src/main.rs`,
`crates/zed/src/zed/quick_action_bar/preview.rs`). No behavior change.
> NOTE: Mechanical changes. Internal structs not renamed on purpose to
reduce git diff noise. Follow-up PRs will do the cleanup (also
mechanical changes)
## Testing
`cargo check -p tabular_data_preview` and `cargo check -p zed` build
clean; preview still opens for csv/tsv/psv/ssv files.
Zed still runs, everything still opens.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- N/A
---------
Co-authored-by: MrSubidubi <finn@zed.dev>