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.

Trail off project/branch name

Piotr Osiewicz98f71a7fa382
diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs
index e6a0c98265d..5bef89d1ee8 100644
--- a/crates/collab_ui/src/collab_titlebar_item.rs
+++ b/crates/collab_ui/src/collab_titlebar_item.rs
@@ -28,7 +28,8 @@ use theme::{AvatarStyle, Theme};
use util::ResultExt;
use workspace::{FollowNextCollaborator, Workspace};
-// const MAX_TITLE_LENGTH: usize = 75;
+const MAX_PROJECT_NAME_LENGTH: usize = 40;
+const MAX_BRANCH_NAME_LENGTH: usize = 40;
actions!(
collab,
@@ -210,11 +211,16 @@ impl CollabTitlebarItem {
names_and_branches.next().unwrap_or(("", None))
};
- let name = name.to_owned();
+ let name = util::truncate_and_trailoff(name, MAX_PROJECT_NAME_LENGTH);
let branch_prepended = entry
.as_ref()
.and_then(RepositoryEntry::branch)
- .map(|branch| format!("/{branch}"));
+ .map(|branch| {
+ format!(
+ "/{}",
+ util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH)
+ )
+ });
let text_style = theme.titlebar.title.clone();
let item_spacing = theme.titlebar.item_spacing;