Truncate tabs in filenames (#50550)
Conrad Irwin
,
Nikolas Gauder
, and
Zed Zippy
created
Closes #19208
Authored-By: @ngauder
Release Notes:
- Editor: truncate long file names in tab titles
---------
Co-authored-by: Nikolas Gauder <nikolas.gauder@tum.de>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Change summary
crates/editor/src/items.rs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Detailed changes
@@ -735,10 +735,13 @@ impl Item for Editor {
h_flex()
.gap_2()
.child(
- Label::new(self.title(cx).to_string())
- .color(label_color)
- .when(params.preview, |this| this.italic())
- .when(was_deleted, |this| this.strikethrough()),
+ Label::new(util::truncate_and_trailoff(
+ &self.title(cx),
+ MAX_TAB_TITLE_LEN,
+ ))
+ .color(label_color)
+ .when(params.preview, |this| this.italic())
+ .when(was_deleted, |this| this.strikethrough()),
)
.when_some(description, |this, description| {
this.child(