From c8b3da6ed9b2ab5a7f9ed1e71442168d3f151e41 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Tue, 14 Apr 2026 13:44:05 -0300 Subject: [PATCH] recent_projects: Fix clipping branch and project name (#53906) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just fixing an issue where the project and branch labels weren't truncating in the project popover. Screenshot 2026-04-14 at 11  49@2x Release Notes: - N/A --- crates/recent_projects/src/recent_projects.rs | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index b4dd12f8ea4a875a27bd2386ab79e35c3481d157..a8144969f6aeb12f2ef16e0a1e1e1b382b4e6712 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -41,8 +41,8 @@ use workspace::ProjectGroupKey; use dev_container::{DevContainerContext, find_devcontainer_configs}; use ui::{ - ContextMenu, Divider, KeyBinding, ListItem, ListItemSpacing, ListSubHeader, PopoverMenu, - PopoverMenuHandle, TintColor, Tooltip, prelude::*, + ContextMenu, Divider, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing, ListSubHeader, + PopoverMenu, PopoverMenuHandle, TintColor, Tooltip, prelude::*, }; use util::{ResultExt, paths::PathExt}; use workspace::{ @@ -1319,6 +1319,9 @@ impl PickerDelegate for RecentProjectsDelegate { let icon = icon_for_remote_connection(self.project_connection_options.as_ref()); + let tooltip_path: SharedString = path.to_string_lossy().to_string().into(); + let tooltip_branch = branch.clone(); + Some( ListItem::new(ix) .toggle_state(selected) @@ -1328,26 +1331,28 @@ impl PickerDelegate for RecentProjectsDelegate { h_flex() .id("open_folder_item") .gap_3() - .flex_grow() + .w_full() + .overflow_hidden() .when(self.has_any_non_local_projects, |this| { this.child(Icon::new(icon).color(Color::Muted)) }) .child( v_flex() + .flex_1() .child( h_flex() + .min_w_0() .gap_1() - .child({ - let highlighted = HighlightedMatch { - text: name.to_string(), - highlight_positions: positions, - color: Color::Default, - }; - highlighted.render(window, cx) - }) + .child(HighlightedLabel::new( + name.to_string(), + positions, + )) .when_some(branch, |this, branch| { this.child( - Label::new(branch).color(Color::Muted), + Label::new(branch) + .color(Color::Muted) + .truncate() + .flex_1(), ) }) .when(is_active, |this| { @@ -1367,7 +1372,18 @@ impl PickerDelegate for RecentProjectsDelegate { }), ) .when(!show_path, |this| { - this.tooltip(Tooltip::text(path.to_string_lossy().to_string())) + this.tooltip(move |_, cx| { + if let Some(branch) = tooltip_branch.clone() { + Tooltip::with_meta( + branch, + None, + tooltip_path.clone(), + cx, + ) + } else { + Tooltip::simple(tooltip_path.clone(), cx) + } + }) }), ) .end_slot(secondary_actions)