Merge pull request #2307 from zed-industries/fix-panic-in-editor-tab-content

Do UTF8-aware truncation on long item names in editor item
This commit is contained in:
Mikayla Maki 2023-03-18 15:49:06 -07:00 committed by GitHub
commit 2a024a255f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -538,11 +538,7 @@ impl Item for Editor {
let description = path.to_string_lossy();
Some(
Label::new(
if description.len() > MAX_TAB_TITLE_LEN {
description[..MAX_TAB_TITLE_LEN].to_string() + ""
} else {
description.into()
},
util::truncate_and_trailoff(&description, MAX_TAB_TITLE_LEN),
style.description.text.clone(),
)
.contained()