mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 15:10:34 +01:00
3fec483014
## 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-948292668334 https://github.com/user-attachments/assets/5ef5f1f1-4f15-4b01-b825-de592d8a1972 https://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>