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.

Don't apply the gap when we don't have any items in the first row

Marshall Bowers53b608378c23
diff --git a/crates/workspace2/src/toolbar.rs b/crates/workspace2/src/toolbar.rs
index cd25582f36c..4431e1b3ff3 100644
--- a/crates/workspace2/src/toolbar.rs
+++ b/crates/workspace2/src/toolbar.rs
@@ -102,16 +102,19 @@ impl Render for Toolbar {
let secondary_item = self.secondary_items().next().map(|item| item.to_any());
+ let has_left_items = self.left_items().count() > 0;
+ let has_right_items = self.right_items().count() > 0;
+
v_stack()
.p_1()
- .gap_2()
+ .when(has_left_items || has_right_items, |this| this.gap_2())
.border_b()
.border_color(cx.theme().colors().border_variant)
.bg(cx.theme().colors().toolbar_background)
.child(
h_stack()
.justify_between()
- .when(self.left_items().count() > 0, |this| {
+ .when(has_left_items, |this| {
this.child(
h_stack()
.flex_1()
@@ -119,7 +122,7 @@ impl Render for Toolbar {
.children(self.left_items().map(|item| item.to_any())),
)
})
- .when(self.right_items().count() > 0, |this| {
+ .when(has_right_items, |this| {
this.child(
h_stack()
.flex_1()