From 8c047d9469e9dff5e2c29cbd9ad0746ba8fb6cc6 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 5 Feb 2026 09:57:08 -0300 Subject: [PATCH] workspace: Remove layout shift from multibuffer toolbar (#48472) The icons in the far left of the multibuffer toolbar were shifting a bit to the side when toggling the buffer search, so this PR fixes that. I'm also removing the labeled button for the expand/collapse all excerpts; relying only on the icon-button version of it, given it's simpler and similarly clear. https://github.com/user-attachments/assets/8ee44c9f-3082-4160-ac77-a3cf489b318a Release Notes: - N/A --- assets/icons/diff_split.svg | 8 ++-- assets/icons/diff_stacked.svg | 7 ++-- crates/search/src/buffer_search.rs | 67 ++++++++---------------------- 3 files changed, 25 insertions(+), 57 deletions(-) diff --git a/assets/icons/diff_split.svg b/assets/icons/diff_split.svg index 6eeab76af206c7f30c40cdc7cd18ba693b531331..de2056466f7ef1081ee00dabb8b4d5baa8fc9217 100644 --- a/assets/icons/diff_split.svg +++ b/assets/icons/diff_split.svg @@ -1,5 +1,5 @@ - - - - + + + + diff --git a/assets/icons/diff_stacked.svg b/assets/icons/diff_stacked.svg index f830fb999e888e9c9f00dfa778401453a6180060..b2d3895ae5466454e9cefc4e77e3c3f2a19cde8c 100644 --- a/assets/icons/diff_stacked.svg +++ b/assets/icons/diff_stacked.svg @@ -1,5 +1,4 @@ - - - - + + + diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 302d99b1b20c2151e2efe5d9358de63628d63cd5..bb192261083ca517fb2de4440e4eb8b6d59a033e 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -154,7 +154,7 @@ impl Render for BufferSearchBar { let is_split = splittable_editor.read(cx).is_split(); let focus_handle = splittable_editor.focus_handle(cx); h_flex() - .gap_0p5() + .gap_1() .child( IconButton::new("diff-stacked", IconName::DiffStacked) .shape(IconButtonShape::Square) @@ -196,42 +196,15 @@ impl Render for BufferSearchBar { let collapse_expand_button = if self.needs_expand_collapse_option(cx) { let query_editor_focus = self.query_editor.focus_handle(cx); - let (icon, label, tooltip_label) = if self.is_collapsed { - (IconName::ChevronUpDown, "Expand All", "Expand All Files") + let (icon, tooltip_label) = if self.is_collapsed { + (IconName::ChevronUpDown, "Expand All Files") } else { - ( - IconName::ChevronDownUp, - "Collapse All", - "Collapse All Files", - ) + (IconName::ChevronDownUp, "Collapse All Files") }; - if self.dismissed { - if has_splittable_editor { - return h_flex() - .gap_1() - .child( - IconButton::new("multibuffer-collapse-expand-empty", icon) - .shape(IconButtonShape::Square) - .tooltip(move |_, cx| { - Tooltip::for_action_in( - tooltip_label, - &ToggleFoldAll, - &query_editor_focus, - cx, - ) - }) - .on_click(|_event, window, cx| { - window.dispatch_action(ToggleFoldAll.boxed_clone(), cx) - }), - ) - .children(split_buttons) - .into_any_element(); - } - - return Button::new("multibuffer-collapse-expand-empty", label) - .icon_position(IconPosition::Start) - .icon(icon) + let collapse_expand_icon_button = |id| { + IconButton::new(id, icon) + .shape(IconButtonShape::Square) .tooltip(move |_, cx| { Tooltip::for_action_in( tooltip_label, @@ -243,27 +216,23 @@ impl Render for BufferSearchBar { .on_click(|_event, window, cx| { window.dispatch_action(ToggleFoldAll.boxed_clone(), cx) }) + }; + + if self.dismissed { + return h_flex() + .pl_0p5() + .gap_1() + .child(collapse_expand_icon_button( + "multibuffer-collapse-expand-empty", + )) + .when(has_splittable_editor, |this| this.children(split_buttons)) .into_any_element(); } Some( h_flex() .gap_1() - .child( - IconButton::new("multibuffer-collapse-expand", icon) - .shape(IconButtonShape::Square) - .tooltip(move |_, cx| { - Tooltip::for_action_in( - tooltip_label, - &ToggleFoldAll, - &query_editor_focus, - cx, - ) - }) - .on_click(|_event, window, cx| { - window.dispatch_action(ToggleFoldAll.boxed_clone(), cx) - }), - ) + .child(collapse_expand_icon_button("multibuffer-collapse-expand")) .children(split_buttons) .into_any_element(), )