Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Conditionally render divider between button groups in the status bar (#24114)
Kevin Sweetf14ef40a132e
diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rsindex bf3e1c7595e..2fa593e6eaf 100644--- a/crates/diagnostics/src/items.rs+++ b/crates/diagnostics/src/items.rs@@ -86,9 +86,6 @@ impl Render for DiagnosticIndicator {h_flex().gap_2()- .pl_1()- .border_l_1()- .border_color(cx.theme().colors().border).child(ButtonLike::new("diagnostic-indicator").child(diagnostic_indicator)diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rsindex 2d1e555383f..bf6d65c03e9 100644--- a/crates/workspace/src/dock.rs+++ b/crates/workspace/src/dock.rs@@ -11,7 +11,7 @@ use schemars::JsonSchema;use serde::{Deserialize, Serialize};use settings::SettingsStore;use std::sync::Arc;-use ui::{h_flex, ContextMenu, IconButton, Tooltip};+use ui::{h_flex, ContextMenu, Divider, DividerColor, IconButton, Tooltip};use ui::{prelude::*, right_click_menu};pub(crate) const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.);@@ -801,7 +801,7 @@ impl Render for PanelButtons {DockPosition::Bottom | DockPosition::Right => (Corner::BottomRight, Corner::TopRight),};- let buttons = dock+ let buttons: Vec<_> = dock.panel_entries.iter().enumerate()@@ -869,9 +869,16 @@ impl Render for PanelButtons {}),),)- });-- h_flex().gap_0p5().children(buttons)+ })+ .collect();++ let has_buttons = !buttons.is_empty();+ h_flex()+ .gap_1()+ .children(buttons)+ .when(has_buttons, |this| {+ this.child(Divider::vertical().color(DividerColor::Border))+ })}}