tab_switcher: Middle-truncate long picker filenames - #59072
Merged
ChristopherBiscardi merged 1 commit intoJun 11, 2026
Merged
Conversation
ChristopherBiscardi
approved these changes
Jun 11, 2026
ChristopherBiscardi
left a comment
Contributor
There was a problem hiding this comment.
Very cool, thanks for taking this on!
This definitely doesn't handle unicode codepoints correctly but notably it doesn't seem like any of the other already-existing truncation code does either, so I'm not going to consider it a blocker for this PR.
For the unicode issue, consider the following polar bear, which is the combination of a bear, a zero-width-joiner, and a snowflake.
aaaa🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️🐻❄️bbbbbbb.txt
When truncated, this splits the middle and results in each side of the emoji rendering.
cppcoffee
pushed a commit
to cppcoffee/zed
that referenced
this pull request
Jun 15, 2026
Follow up to zed-industries#59072 adjusting some UI design for the file finder that got regressed. Release Notes: - N/A
This was referenced Jun 18, 2026
Closed
This was referenced Jul 8, 2026
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
…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
Follow up to zed-industries#59072 adjusting some UI design for the file finder that got regressed. Release Notes: - N/A
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
This follow-up was inspired by Christopher’s suggestion in the review comment on #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: AddsTextOverflow::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
Manual test after change :
Screencast.from.2026-06-10.22-54-48.webm
Self-Review Checklist
Release Notes: