# tab_switcher: Show full file names without truncation \(\#58483\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/ea7b4c75ee7df528845bed0a448b492a6fb3ca66)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: ea7b4c75ee7df528845bed0a448b492a6fb3ca66

Requested commit: ea7b4c75ee7df528845bed0a448b492a6fb3ca66

Commit: ea7b4c75ee7df528845bed0a448b492a6fb3ca66

Tree: 1e80db8d81dbe1f65b9b8e75740518f3fa073bb0

Author: saberoueslati

Committer: GitHub

## Message

```
tab_switcher: Show full file names without truncation (#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 #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
```

## Parents

- [96165ec62647cb5db0a5cf1c57214f2970c6eda4](https://git.cafe/gitcafe/zed/commit/96165ec62647cb5db0a5cf1c57214f2970c6eda4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/ea7b4c75ee7df528845bed0a448b492a6fb3ca66?format=markdown)
