tab_switcher: Show full file names without truncation - #58483
Merged
ChristopherBiscardi merged 1 commit intoJun 4, 2026
Merged
Conversation
ChristopherBiscardi
approved these changes
Jun 4, 2026
ChristopherBiscardi
left a comment
Contributor
There was a problem hiding this comment.
Functionality seems good to me for this fix.
That brings up another thought though, since this doesn't fix all long filenames. Any which are longer than the tab bar toggle will still run under and truncate abruptly.
Typically the solution for this is a middle-truncation that shows the start and end of the string. In this case offending filenames would look like this, which shows important context at the beginning and end of the string, such as .c and .h.
a_really_really_long...that_is_good.c
a_really_really_long...that_is_good.h
ChristopherBiscardi
enabled auto-merge
June 4, 2026 05:17
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
Jun 8, 2026
…#58483) ## Context The tab switcher was truncating file names at the same 24-character limit (`MAX_TAB_TITLE_LEN`) used by the narrow tab bar. This made files that share a long common prefix, like `test_cpp_file_long_name.h` and `test_cpp_file_long_name.cpp`, render identically, with both becoming `test_cpp_file_long_name.…`. The fix adds a `max_title_len: Option<usize>` field to `TabContentParams`. When `None` (the default, used by the tab bar), `Editor::tab_content` falls back to `MAX_TAB_TITLE_LEN` as before. The tab switcher passes `Some(usize::MAX)`, which skips truncation entirely and lets the UI container constrain the displayed text naturally. Closes zed-industries#58461 ## How to Review - **`crates/workspace/src/item.rs`** : Adds `max_title_len: Option<usize>` to `TabContentParams`. Derives `Default` so `None` is the zero-cost default; two existing struct literals in `pane.rs` that couldn't use `..Default::default()` were updated to be explicit. - **`crates/editor/src/items.rs`** : In `Editor::tab_content`, both the title label and the description path now use `params.max_title_len.unwrap_or(MAX_TAB_TITLE_LEN)` instead of the hardcoded constant. - **`crates/workspace/src/pane.rs`** : Two `TabContentParams` struct literals updated to include `max_title_len: None`, preserving the existing 24-char tab bar behaviour. - **`crates/tab_switcher/src/tab_switcher.rs`** : Sets `max_title_len: Some(usize::MAX)` in `render_match`, opting the tab switcher out of truncation. Video of the manual test below : Used the same names of the files in the issue but also longer ones to showcase the behavior in different file lengths : [Screencast from 2026-06-04 00-08-02.webm](https://github.com/user-attachments/assets/5f388257-2f3d-494c-ab50-bf46496dbd38) I'm obviously open to discussing this further specially the new truncation behavior of the file with the longest name in the manual test. ## 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 is consistent with the UI/UX checklist - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed tab switcher truncating long file names, making files with a shared prefix indistinguishable
5 tasks
pull Bot
pushed a commit
to sipsuru/zed-winbuild
that referenced
this pull request
Jun 11, 2026
…9072) ## Context This follow-up was inspired by Christopher’s suggestion in the review comment on zed-industries#58483: long filenames should truncate in the middle so both the beginning and the suffix/extension remain visible. Previously, very long filenames in picker rows could still be clipped or end-truncated, making files with shared prefixes hard to distinguish. This adds middle-truncation support to GPUI text overflow and applies it to filename-focused picker surfaces: the tab switcher and the Ctrl-P file finder. Normal editor tab bar behavior remains unchanged and continues to use the existing title length cap. ## How to Review - **`crates/gpui/src/style.rs`, `crates/gpui/src/styled.rs`, `crates/gpui/src/elements/text.rs`, `crates/gpui/src/text_system/line_wrapper.rs`**: Adds `TextOverflow::TruncateMiddle`, wires it through text layout, and implements middle truncation while preserving valid text runs. Very narrow widths now show the truncation affix instead of falling back to the abruptly clipped original text. - **`crates/ui/src/components/label/label_like.rs`, `crates/ui/src/components/label/label.rs`, `crates/ui/src/components/label/highlighted_label.rs`**: Exposes middle truncation through the shared label components. - **`crates/workspace/src/item.rs`, `crates/editor/src/items.rs`, `crates/workspace/src/pane.rs`, `crates/tab_switcher/src/tab_switcher.rs`**: Adds an explicit tab-content opt-in for middle truncation. The tab switcher enables it, while the normal tab bar and dragged tabs keep their existing behavior. - **`crates/file_finder/src/file_finder.rs`**: Applies middle truncation to Ctrl-P file finder filenames and lets the path shrink from the start so long paths do not hide important filename suffixes. Manual test before change : [Screencast from 2026-06-10 22-59-28.webm](https://github.com/user-attachments/assets/5e032646-a48c-45f2-8fe2-0424507fd576) Manual test after change : [Screencast from 2026-06-10 22-54-48.webm](https://github.com/user-attachments/assets/4b9253da-f169-4ed1-bdd5-ee71dcf49a83) ## 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 is consistent with the UI/UX checklist - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Improved long filename truncation in the tab switcher and file finder so extensions remain visible.
This was referenced Jun 18, 2026
Closed
This was referenced Jul 1, 2026
This was referenced Jul 10, 2026
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
…#58483) ## Context The tab switcher was truncating file names at the same 24-character limit (`MAX_TAB_TITLE_LEN`) used by the narrow tab bar. This made files that share a long common prefix, like `test_cpp_file_long_name.h` and `test_cpp_file_long_name.cpp`, render identically, with both becoming `test_cpp_file_long_name.…`. The fix adds a `max_title_len: Option<usize>` field to `TabContentParams`. When `None` (the default, used by the tab bar), `Editor::tab_content` falls back to `MAX_TAB_TITLE_LEN` as before. The tab switcher passes `Some(usize::MAX)`, which skips truncation entirely and lets the UI container constrain the displayed text naturally. Closes zed-industries#58461 ## How to Review - **`crates/workspace/src/item.rs`** : Adds `max_title_len: Option<usize>` to `TabContentParams`. Derives `Default` so `None` is the zero-cost default; two existing struct literals in `pane.rs` that couldn't use `..Default::default()` were updated to be explicit. - **`crates/editor/src/items.rs`** : In `Editor::tab_content`, both the title label and the description path now use `params.max_title_len.unwrap_or(MAX_TAB_TITLE_LEN)` instead of the hardcoded constant. - **`crates/workspace/src/pane.rs`** : Two `TabContentParams` struct literals updated to include `max_title_len: None`, preserving the existing 24-char tab bar behaviour. - **`crates/tab_switcher/src/tab_switcher.rs`** : Sets `max_title_len: Some(usize::MAX)` in `render_match`, opting the tab switcher out of truncation. Video of the manual test below : Used the same names of the files in the issue but also longer ones to showcase the behavior in different file lengths : [Screencast from 2026-06-04 00-08-02.webm](https://github.com/user-attachments/assets/5f388257-2f3d-494c-ab50-bf46496dbd38) I'm obviously open to discussing this further specially the new truncation behavior of the file with the longest name in the manual test. ## 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 is consistent with the UI/UX checklist - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed tab switcher truncating long file names, making files with a shared prefix indistinguishable
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
…9072) ## Context This follow-up was inspired by Christopher’s suggestion in the review comment on zed-industries#58483: long filenames should truncate in the middle so both the beginning and the suffix/extension remain visible. Previously, very long filenames in picker rows could still be clipped or end-truncated, making files with shared prefixes hard to distinguish. This adds middle-truncation support to GPUI text overflow and applies it to filename-focused picker surfaces: the tab switcher and the Ctrl-P file finder. Normal editor tab bar behavior remains unchanged and continues to use the existing title length cap. ## How to Review - **`crates/gpui/src/style.rs`, `crates/gpui/src/styled.rs`, `crates/gpui/src/elements/text.rs`, `crates/gpui/src/text_system/line_wrapper.rs`**: Adds `TextOverflow::TruncateMiddle`, wires it through text layout, and implements middle truncation while preserving valid text runs. Very narrow widths now show the truncation affix instead of falling back to the abruptly clipped original text. - **`crates/ui/src/components/label/label_like.rs`, `crates/ui/src/components/label/label.rs`, `crates/ui/src/components/label/highlighted_label.rs`**: Exposes middle truncation through the shared label components. - **`crates/workspace/src/item.rs`, `crates/editor/src/items.rs`, `crates/workspace/src/pane.rs`, `crates/tab_switcher/src/tab_switcher.rs`**: Adds an explicit tab-content opt-in for middle truncation. The tab switcher enables it, while the normal tab bar and dragged tabs keep their existing behavior. - **`crates/file_finder/src/file_finder.rs`**: Applies middle truncation to Ctrl-P file finder filenames and lets the path shrink from the start so long paths do not hide important filename suffixes. Manual test before change : [Screencast from 2026-06-10 22-59-28.webm](https://github.com/user-attachments/assets/5e032646-a48c-45f2-8fe2-0424507fd576) Manual test after change : [Screencast from 2026-06-10 22-54-48.webm](https://github.com/user-attachments/assets/4b9253da-f169-4ed1-bdd5-ee71dcf49a83) ## 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 is consistent with the UI/UX checklist - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Improved long filename truncation in the tab switcher and file finder so extensions remain visible.
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
…#58483) ## Context The tab switcher was truncating file names at the same 24-character limit (`MAX_TAB_TITLE_LEN`) used by the narrow tab bar. This made files that share a long common prefix, like `test_cpp_file_long_name.h` and `test_cpp_file_long_name.cpp`, render identically, with both becoming `test_cpp_file_long_name.…`. The fix adds a `max_title_len: Option<usize>` field to `TabContentParams`. When `None` (the default, used by the tab bar), `Editor::tab_content` falls back to `MAX_TAB_TITLE_LEN` as before. The tab switcher passes `Some(usize::MAX)`, which skips truncation entirely and lets the UI container constrain the displayed text naturally. Closes zed-industries#58461 ## How to Review - **`crates/workspace/src/item.rs`** : Adds `max_title_len: Option<usize>` to `TabContentParams`. Derives `Default` so `None` is the zero-cost default; two existing struct literals in `pane.rs` that couldn't use `..Default::default()` were updated to be explicit. - **`crates/editor/src/items.rs`** : In `Editor::tab_content`, both the title label and the description path now use `params.max_title_len.unwrap_or(MAX_TAB_TITLE_LEN)` instead of the hardcoded constant. - **`crates/workspace/src/pane.rs`** : Two `TabContentParams` struct literals updated to include `max_title_len: None`, preserving the existing 24-char tab bar behaviour. - **`crates/tab_switcher/src/tab_switcher.rs`** : Sets `max_title_len: Some(usize::MAX)` in `render_match`, opting the tab switcher out of truncation. Video of the manual test below : Used the same names of the files in the issue but also longer ones to showcase the behavior in different file lengths : [Screencast from 2026-06-04 00-08-02.webm](https://github.com/user-attachments/assets/5f388257-2f3d-494c-ab50-bf46496dbd38) I'm obviously open to discussing this further specially the new truncation behavior of the file with the longest name in the manual test. ## 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 is consistent with the UI/UX checklist - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed tab switcher truncating long file names, making files with a shared prefix indistinguishable
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
…9072) ## Context This follow-up was inspired by Christopher’s suggestion in the review comment on zed-industries#58483: long filenames should truncate in the middle so both the beginning and the suffix/extension remain visible. Previously, very long filenames in picker rows could still be clipped or end-truncated, making files with shared prefixes hard to distinguish. This adds middle-truncation support to GPUI text overflow and applies it to filename-focused picker surfaces: the tab switcher and the Ctrl-P file finder. Normal editor tab bar behavior remains unchanged and continues to use the existing title length cap. ## How to Review - **`crates/gpui/src/style.rs`, `crates/gpui/src/styled.rs`, `crates/gpui/src/elements/text.rs`, `crates/gpui/src/text_system/line_wrapper.rs`**: Adds `TextOverflow::TruncateMiddle`, wires it through text layout, and implements middle truncation while preserving valid text runs. Very narrow widths now show the truncation affix instead of falling back to the abruptly clipped original text. - **`crates/ui/src/components/label/label_like.rs`, `crates/ui/src/components/label/label.rs`, `crates/ui/src/components/label/highlighted_label.rs`**: Exposes middle truncation through the shared label components. - **`crates/workspace/src/item.rs`, `crates/editor/src/items.rs`, `crates/workspace/src/pane.rs`, `crates/tab_switcher/src/tab_switcher.rs`**: Adds an explicit tab-content opt-in for middle truncation. The tab switcher enables it, while the normal tab bar and dragged tabs keep their existing behavior. - **`crates/file_finder/src/file_finder.rs`**: Applies middle truncation to Ctrl-P file finder filenames and lets the path shrink from the start so long paths do not hide important filename suffixes. Manual test before change : [Screencast from 2026-06-10 22-59-28.webm](https://github.com/user-attachments/assets/5e032646-a48c-45f2-8fe2-0424507fd576) Manual test after change : [Screencast from 2026-06-10 22-54-48.webm](https://github.com/user-attachments/assets/4b9253da-f169-4ed1-bdd5-ee71dcf49a83) ## 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 is consistent with the UI/UX checklist - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Improved long filename truncation in the tab switcher and file finder so extensions remain visible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The tab switcher was truncating file names at the same 24-character limit (
MAX_TAB_TITLE_LEN) used by the narrow tab bar. This made files that share a long common prefix, liketest_cpp_file_long_name.handtest_cpp_file_long_name.cpp, render identically, with both becomingtest_cpp_file_long_name.….The fix adds a
max_title_len: Option<usize>field toTabContentParams. WhenNone(the default, used by the tab bar),Editor::tab_contentfalls back toMAX_TAB_TITLE_LENas before. The tab switcher passesSome(usize::MAX), which skips truncation entirely and lets the UI container constrain the displayed text naturally.Closes #58461
How to Review
crates/workspace/src/item.rs: Addsmax_title_len: Option<usize>toTabContentParams. DerivesDefaultsoNoneis the zero-cost default; two existing struct literals inpane.rsthat couldn't use..Default::default()were updated to be explicit.crates/editor/src/items.rs: InEditor::tab_content, both the title label and the description path now useparams.max_title_len.unwrap_or(MAX_TAB_TITLE_LEN)instead of the hardcoded constant.crates/workspace/src/pane.rs: TwoTabContentParamsstruct literals updated to includemax_title_len: None, preserving the existing 24-char tab bar behaviour.crates/tab_switcher/src/tab_switcher.rs: Setsmax_title_len: Some(usize::MAX)inrender_match, opting the tab switcher out of truncation.Video of the manual test below :
Used the same names of the files in the issue but also longer ones to showcase the behavior in different file lengths :
Screencast.from.2026-06-04.00-08-02.webm
I'm obviously open to discussing this further specially the new truncation behavior of the file with the longest name in the manual test.
Self-Review Checklist
Release Notes: