Commit Graph
8 Commits
Author SHA1 Message Date
Kirill Bulatov 7ea8eb3f2e Support CSV preview in project-less set-ups (#63350)
Closes https://github.com/zed-industries/zed/issues/63265

Release Notes:

- Fixed CSV preview not showing in project-less set-ups
2026-08-31 12:04:06 +00:00
Oleksandr KholiavkoandSmit Barmase 75917d2f73 tabular_data_preview: Add shortcut to open tabular data preview (#63369)
## TL;DR

Adds `cmd-shift-v` / `cmd-k v` (ctrl on linux/windows) to open the
tabular data preview for `csv`/`tsv`/`ssv`/`psv` files, mirroring the
existing `markdown::OpenPreview(ToTheSide)` and
`svg::OpenPreview(ToTheSide)` bindings/context pattern already in the
default keymaps.

Extension check kept explicit (not just `"Editor"`) so it doesn't
compete with the `md`/`svg` blocks bound to the same keys on their own
extensions.

## Testing

- Manually verified `cmd-shift-v` / `cmd-k v` open tabular data preview
on `.csv`/`.tsv`/`.ssv`/`.psv` files, no-op on other extensions.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] UI standards followed
- [ ] Tests cover the new/changed behavior
- [x] Performance impact considered, acceptable

Release Notes:

- Added shortcuts to open the tabular data preview for CSV/TSV/SSV/PSV
files (similar to md/svg preview)

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-08-31 11:59:43 +00:00
Oleksandr Kholiavko 134e04444c tabular_data_preview: Revive filter funnel icon (#63266)
# Objective

Originally, `IconName::Filter` was a funnel glyph and
`IconName::Sliders` was used for settings/controls.

In #60937 (commit `1a06fd4f2b`), `filter.svg` was replaced with the
sliders glyph, and `sliders.svg` / `Sliders` enum variants were deleted.
Consequently, `IconName::Filter` has become a sliders-shaped icon used
across 8+ surfaces in Zed (git_ui, search, debugger_ui, keymap_editor,
language_tools, quick_action_bar, editor view settings).

When moving tabular data preview settings to follow the editor's
convention (using `IconName::Filter` sliders for table view settings),
column filter buttons in the table header were left using the same
sliders icon instead of a traditional funnel.

Repurposing `IconName::Filter` back to a funnel would break all other UI
surfaces across Zed.

## Solution

- Restored the funnel icon under a new dedicated
`IconName::FilterFunnel` variant (`assets/icons/filter_funnel.svg` and
`crates/icons/src/icons.rs`).
- Updated `tabular_data_preview` column filter trigger buttons
(`table_header.rs`) to use `IconName::FilterFunnel`.
- Left all existing `IconName::Filter` (sliders) usages across the app
untouched.

Before:
<img width="363" height="156" alt="image"
src="https://github.com/user-attachments/assets/84ac5f87-c0f7-4de9-94ea-e4040e3b4a4a"
/>

After:
<img width="361" height="151" alt="image"
src="https://github.com/user-attachments/assets/38514f3a-0710-4273-b227-4623bf78410b"
/>

## Testing

- `cargo check -p icons -p tabular_data_preview` and `./script/clippy`
build clean.
- `cargo test -p tabular_data_preview --lib` passes.
- Verified column filter button renders the funnel icon in tabular data
preview and highlights correctly when filters are active.

## 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:

- Replace column filter icon in tabular data preview with filter funnel
2026-08-31 11:43:50 +00:00
Oleksandr KholiavkoandAnthony Eid 9787e3fabd tabular_data_preview: Move settings into popup (refine UI) (#62812)
# Objective

The settings panel rendered as a persistent bar above the table, always
taking up vertical space even though most of its controls (text
alignment, filter sort order, multiline rows, dev-only toggles) are
rarely touched. @Anthony-Eid suggested reworking it into popover

## Solution

Replaced the always-visible settings panel with a single settings icon
button (next to the row-identifier toggle) that opens a popover menu
with the same controls, grouped under headers:
- Text Alignment, Filter Sort, Display
- and (behind `dev-tools`) Rendering Mode / debug toggles.

Frees up the row of vertical space previously occupied by the panel.
Similarly how it's done in git pannel


## Testing

`cargo check -p tabular_data_preview` and `--features dev-tools` both
build clean; `./script/clippy` clean.
Manually opened the popover and toggled each setting (alignment, filter
sort, multiline rows) to confirm they still apply and persist while the
popover stays open.

## Demo

| Before | After |
| --- | --- |
| <img width="720" height="427" alt="image"
src="https://github.com/user-attachments/assets/0af2e7a5-ab70-4cb8-b106-6cecd5a5752d"
/> | <img width="721" height="384" alt="image"
src="https://github.com/user-attachments/assets/c2938156-938e-4f05-b842-08e599e4bcdd"
/> |

Line numbers vs Row number
<img width="572" height="253" alt="image"
src="https://github.com/user-attachments/assets/1ccc5e8b-ffa3-4a8f-9dcb-07cba340306c"
/>

<img width="571" height="412" alt="image"
src="https://github.com/user-attachments/assets/ecb3c686-cb4c-41e7-918c-b8a5e123a452"
/>


## 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

---

~~# NOTE TO REVIEWER (release notes related)~~
~~This feature is still under feature flag, but I've head from
@Anthony-Eid few weeks ago that it's already good enough to go public.
Do we make it live and I keep release notes or should I remove release
notes due to some blockers?~~

Disabled feature flag in
https://github.com/zed-industries/zed/pull/62773

---

Release Notes:

- Refine tabular data preview setting UI

---------

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
2026-08-26 05:32:15 +00:00
Enzo GAZZOLIandKirill Bulatov 1155a5becd Render control characters in tab titles and project panel entries (#62875)
# Objective

Fixes #62664

File names may contain control characters (`\n`, `\r`, `\t`, …) on most
platforms. Zed rendered them verbatim, so a file named `notes\ndraft.md`
broke the layout of its tab and of its project panel entry instead of
showing a readable name. The same held anywhere else a name reached the
screen without going through `Label::single_line`.

## Solution

The substitution lives in one shared place,
`ui::utils::replace_control_characters`, reached through
`Label::single_line`. `\n` keeps rendering as the `⏎` Zed already used,
so nothing that renders correctly today changes; every other C0 control
character maps onto the Unicode "Control Pictures" block by a single
rule (`U+2400 + code point`), giving `␉` for tab and `␍` for carriage
return. `DEL` maps to `␡`. C1 controls are left alone, having no
equivalent there.

Where that is wired in:

- **`Label::single_line`** — replaces its previous `\n`-only
substitution. The project panel already used it everywhere, including
folded directory components, so the panel is fixed by this alone.
- **Editor tabs** and the **default `Item::tab_content`**, neither of
which called `single_line`.
- **Terminal tab titles**, which render through their own `tab_content`.
Those titles come from OSC escape sequences, so the control characters
in them are attacker-controlled.
- **`HighlightedLabel::single_line`**, which never substituted anything
— not even `\n`. See below.
- **The file finder**, for both the file name and the path.
- **Nine `tab_content` overrides in git_ui**, by deleting them.
- **`HighlightedMatchWithPaths`**, for both the match label and its
paths — it backs the tab switcher and the outline panel, among others.

### `HighlightedLabel` needs its offsets moved, not just its text

Its highlight indices are byte offsets, and every stand-in is wider in
bytes than the character it replaces, so the offsets have to move with
the text. Left alone they index into the middle of a character, and
`highlight_ranges` slices the string at exactly those offsets — which
panics in release builds too. The constructor's `debug_panic!` does not
cover this, since `single_line` runs after construction.

So `replace_control_characters_remapping_offsets` substitutes and remaps
in one pass, over an old-to-new byte offset table built the way
`ensure_uniform_list_compatible_label` does it in `lsp_store`. This also
fixes the call sites that already asked for a single line, including the
branch picker and the tabular column filter values.

### Deleting the git_ui overrides

Nine files replicated the default `Item::tab_content` verbatim except
for the colour, hardcoding `selected ? Default : Muted` instead of
`params.text_color()`. Deleting them lets those tabs inherit the fixed
default, and fixes a second bug along the way: none of them dimmed when
the pane lost focus. Titles and icons are unaffected — they come from
`tab_content_text` and `tab_icon`, which the default calls.
`git_graph.rs` already did it this way.

### Tabular column headers

These never went through a `Label` at all: the raw `SharedString` was a
child of a `div`. They now display stand-ins, while right-click-copy
still yields the real column name.

Two notes for reviewers:

- Both helpers avoid allocating when there is nothing to replace, so the
common path is untouched. The previous `self.label.replace('\n', "⏎")`
allocated a `String` on every render for every label — including every
visible project panel entry, every frame.
- Every stand-in is exactly one character, so character offsets are
preserved and the existing `truncate_and_trailoff` math on tab titles
stays correct.

## Testing

- Unit tests cover both helpers: each control character's substitution,
repeated occurrences, multi-byte characters (accents, emoji), the
borrow-vs-own behaviour, the preserved character count, C1 passthrough,
and — for the remapping — offsets before, at and after a replacement,
offsets at and past the end, and the invariant that every remapped
offset lands on a character boundary.
- Unit tests cover `Label::single_line` and
`HighlightedLabel::single_line`, the entry points every call site uses.
`highlighted_label.rs` had no tests before.
- `cargo test -p ui -p file_finder -p workspace -p project_panel -p
git_ui -p git_ui_core -p terminal_view -p tabular_data_preview` passes
(774 tests), as do `cargo clippy` and `cargo fmt --check`.
- No existing test changes behaviour: tests assert on
`tab_content_text`, which is untouched; only rendering paths changed.
- Verified manually on macOS (aarch64) — see Showcase.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments — none added
- [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

A directory holding `report<TAB>table.csv`, `notes<LF>draft.md`,
`carriage<CR>return.txt` and a normally named `normal.txt`, all four
open as tabs.

**Before**


![before](https://raw.githubusercontent.com/Taqinou/zed/0d5ee2b4f94db7bcb713298c38cf411458b75239/62664/before.png)

**After**


![after](https://raw.githubusercontent.com/Taqinou/zed/0d5ee2b4f94db7bcb713298c38cf411458b75239/62664/after.png)

Three things change:

1. **The `notes<LF>draft.md` tab** is the clearest one. Before, the
literal newline splits the tab across two lines — `notes` above
`draft.md` — distorting the whole tab bar. After, it stays on one line.
2. **`carriage<CR>return.txt` in the project panel** renders as
`carriagereturn.txt` before: the `\r` is completely invisible, so the
name reads as one word and there is no way to tell a character is there.
After, it renders as `carriage␍return.txt`.
3. **`report<TAB>table.csv`** shows a bare gap before, indistinguishable
from a space. After, it renders as `report␉table.csv`.

Note that `notes<LF>draft.md` looks the same in the project panel in
both shots: that entry already called `single_line`, which already
handled `\n`. That is precisely the asymmetry this PR removes.

### File finder

Before, the newline also breaks the list itself — the
`notes<LF>draft.md` row grows to two lines and overlaps the row beneath
it.

**Before**

![file finder
before](https://raw.githubusercontent.com/Taqinou/zed/0d5ee2b4f94db7bcb713298c38cf411458b75239/62664/finder-before.png)

**After**

![file finder
after](https://raw.githubusercontent.com/Taqinou/zed/0d5ee2b4f94db7bcb713298c38cf411458b75239/62664/finder-after.png)

Searching for `table` exercises the offset remapping, the match falling
after the control character:

**Before**

![match
before](https://raw.githubusercontent.com/Taqinou/zed/0d5ee2b4f94db7bcb713298c38cf411458b75239/62664/match-before.png)

**After**

![match
after](https://raw.githubusercontent.com/Taqinou/zed/0d5ee2b4f94db7bcb713298c38cf411458b75239/62664/match-after.png)

One thing this PR does **not** cover: the breadcrumb below the tab bar
still renders the raw tab character, as it goes through a different
path.

## Release Notes:

- Fixed file names containing control characters, such as tabs and
newlines, rendering unreadably in tabs, the project panel, the file
finder, the tab switcher and terminal tab titles.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-08-19 21:10:56 +00:00
Anthony Eid 9a209fdf13 Enable CSV preview for all users (#62773)
Closes #58145

Remove the `tabular-data-preview` feature flag and register CSV preview
actions and the quick action bar button for every user. Also remove the
now-unused `feature_flags` dependency from the CSV preview crate.

Release Notes:

- Added CSV preview access for all users
2026-08-19 01:15:44 +00:00
Oleksandr Kholiavko 4aef01479b tabular_data_preview: Finish generalizing crate naming (#62807)
# 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
2026-08-18 12:28:30 +00:00
Oleksandr KholiavkoandMrSubidubi d0394b7c8c Rename csv_preview crate to tabular_data_preview (#62768)
# 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>
2026-08-18 10:10:04 +00:00