From 377909a64603b44fdbc681a41b2e0ede9ee9e359 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 5 May 2025 22:28:35 -0300 Subject: [PATCH] Fix toolbar spacing regressions (#29964) Cleaning up as I introduced a few regressions in this PR: https://github.com/zed-industries/zed/pull/29866. Release Notes: - N/A --- crates/agent/src/agent_diff.rs | 56 +++++++++++++------------- crates/git_ui/src/project_diff.rs | 3 +- crates/workspace/src/toolbar.rs | 2 +- crates/zed/src/zed/quick_action_bar.rs | 1 - 4 files changed, 29 insertions(+), 33 deletions(-) diff --git a/crates/agent/src/agent_diff.rs b/crates/agent/src/agent_diff.rs index 2a70939cf8..e27315b022 100644 --- a/crates/agent/src/agent_diff.rs +++ b/crates/agent/src/agent_diff.rs @@ -26,7 +26,7 @@ use std::{ ops::Range, sync::Arc, }; -use ui::{Divider, IconButtonShape, KeyBinding, Tooltip, prelude::*, vertical_divider}; +use ui::{IconButtonShape, KeyBinding, Tooltip, prelude::*, vertical_divider}; use util::ResultExt; use workspace::{ Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, @@ -1035,8 +1035,8 @@ impl Render for AgentDiffToolbar { } }), ) - .into_any(), - Divider::vertical().into_any_element(), + .into_any_element(), + vertical_divider().into_any_element(), h_flex() .gap_0p5() .child( @@ -1069,37 +1069,34 @@ impl Render for AgentDiffToolbar { this.dispatch_action(&KeepAll, window, cx) })), ) - .into_any(), - Divider::vertical().into_any_element(), + .into_any_element(), ], }; h_flex() .track_focus(&editor_focus_handle) .size_full() - .child( - h_flex() - .py(DynamicSpacing::Base08.rems(cx)) - .px_2() - .gap_1() - .children(content) - .when_some(editor.read(cx).workspace(), |this, _workspace| { - this.child( - IconButton::new("review", IconName::ListCollapse) - .icon_size(IconSize::Small) - .tooltip(Tooltip::for_action_title_in( - "Review All Files", - &OpenAgentDiff, - &editor_focus_handle, - )) - .on_click({ - cx.listener(move |this, _, window, cx| { - this.dispatch_action(&OpenAgentDiff, window, cx); - }) - }), - ) - }), - ) + .px_1() + .mr_1() + .gap_1() + .children(content) + .child(vertical_divider()) + .when_some(editor.read(cx).workspace(), |this, _workspace| { + this.child( + IconButton::new("review", IconName::ListCollapse) + .icon_size(IconSize::Small) + .tooltip(Tooltip::for_action_title_in( + "Review All Files", + &OpenAgentDiff, + &editor_focus_handle, + )) + .on_click({ + cx.listener(move |this, _, window, cx| { + this.dispatch_action(&OpenAgentDiff, window, cx); + }) + }), + ) + }) .child(vertical_divider()) .on_action({ let editor = editor.clone(); @@ -1129,7 +1126,8 @@ impl Render for AgentDiffToolbar { let focus_handle = agent_diff.focus_handle(cx); h_group_xl() - .px_2() + .my_neg_1() + .py_1() .items_center() .flex_wrap() .child( diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index 6e7fa3c816..f3f2caf3df 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -893,9 +893,8 @@ impl Render for ProjectDiffToolbar { h_group_xl() .my_neg_1() - .items_center() .py_1() - .px_2() + .items_center() .flex_wrap() .justify_between() .child( diff --git a/crates/workspace/src/toolbar.rs b/crates/workspace/src/toolbar.rs index a8f831f3f0..9d6626af80 100644 --- a/crates/workspace/src/toolbar.rs +++ b/crates/workspace/src/toolbar.rs @@ -106,6 +106,7 @@ impl Render for Toolbar { v_flex() .group("toolbar") .relative() + .p(DynamicSpacing::Base08.rems(cx)) .when(has_left_items || has_right_items, |this| { this.gap(DynamicSpacing::Base08.rems(cx)) }) @@ -121,7 +122,6 @@ impl Render for Toolbar { .when(has_left_items, |this| { this.child( h_flex() - .p(DynamicSpacing::Base08.rems(cx)) .flex_auto() .justify_start() .overflow_x_hidden() diff --git a/crates/zed/src/zed/quick_action_bar.rs b/crates/zed/src/zed/quick_action_bar.rs index cf3dedcbf8..07623b508f 100644 --- a/crates/zed/src/zed/quick_action_bar.rs +++ b/crates/zed/src/zed/quick_action_bar.rs @@ -433,7 +433,6 @@ impl Render for QuickActionBar { h_flex() .id("quick action bar") - .p(DynamicSpacing::Base08.rems(cx)) .gap(DynamicSpacing::Base01.rems(cx)) .children(self.render_repl_menu(cx)) .children(self.render_toggle_markdown_preview(self.workspace.clone(), cx))