Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions crates/editor/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,10 @@ impl Item for Editor {
return None;
}

Some(util::truncate_and_trailoff(description, MAX_TAB_TITLE_LEN))
Some(util::truncate_and_trailoff(
description,
params.max_title_len.unwrap_or(MAX_TAB_TITLE_LEN),
))
});

// Whether the file was saved in the past but is now deleted.
Expand All @@ -783,7 +786,7 @@ impl Item for Editor {
.child(
Label::new(util::truncate_and_trailoff(
&self.title(cx),
MAX_TAB_TITLE_LEN,
params.max_title_len.unwrap_or(MAX_TAB_TITLE_LEN),
))
.color(label_color)
.when(params.preview, |this| this.italic())
Expand Down
1 change: 1 addition & 0 deletions crates/tab_switcher/src/tab_switcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ impl PickerDelegate for TabSwitcherDelegate {
selected: true,
preview: tab_match.preview,
deemphasized: false,
max_title_len: Some(usize::MAX),
};
let label = tab_match.item.tab_content(params, window, cx);

Expand Down
2 changes: 2 additions & 0 deletions crates/workspace/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ pub struct TabContentParams {
pub preview: bool,
/// Tab content should be deemphasized when active pane does not have focus.
pub deemphasized: bool,
/// Maximum character length for the title. None = use the item's own default (typically MAX_TAB_TITLE_LEN).
pub max_title_len: Option<usize>,
}

impl TabContentParams {
Expand Down
2 changes: 2 additions & 0 deletions crates/workspace/src/pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2794,6 +2794,7 @@ impl Pane {
selected: is_active,
preview: is_preview,
deemphasized: !self.has_focus(window, cx),
max_title_len: None,
},
window,
cx,
Expand Down Expand Up @@ -4930,6 +4931,7 @@ impl Render for DraggedTab {
selected: false,
preview: false,
deemphasized: false,
max_title_len: None,
},
window,
cx,
Expand Down
Loading