Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Do UTF8-aware truncation on long item names in editor item

Mikayla Maki436c59d8efc6
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs
index cda702de00f..1d273a991ee 100644
--- a/crates/editor/src/items.rs
+++ b/crates/editor/src/items.rs
@@ -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()