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.

Use truncate_and_trailoff function

Petros Amoiridis9bff82f16179
diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs
index d3d5c437c5e..a4a7a520ae9 100644
--- a/crates/search/src/project_search.rs
+++ b/crates/search/src/project_search.rs
@@ -259,11 +259,7 @@ impl Item for ProjectSearchView {
.boxed(),
)
.with_children(self.model.read(cx).active_query.as_ref().map(|query| {
- let query_text = if query.as_str().len() > MAX_TAB_TITLE_LEN {
- query.as_str()[..MAX_TAB_TITLE_LEN].to_string() + "…"
- } else {
- query.as_str().to_string()
- };
+ let query_text = util::truncate_and_trailoff(query.as_str(), MAX_TAB_TITLE_LEN);
Label::new(query_text, tab_theme.label.clone())
.aligned()