From e839dc5ee62d2b86c18c0666c47b5fbb9127d62f Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 23 Dec 2023 21:53:08 +0200 Subject: [PATCH] Hide pane tab bar for 0 items, hide its end buttons for no focus --- crates/workspace2/src/pane.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs index bcf36dfe18..ecbebcfa36 100644 --- a/crates/workspace2/src/pane.rs +++ b/crates/workspace2/src/pane.rs @@ -1684,9 +1684,11 @@ impl Pane { .tooltip(|cx| Tooltip::for_action("Go Forward", &GoForward, cx)), ), ) - .end_child({ - let render_tab_buttons = self.render_tab_bar_buttons.clone(); - render_tab_buttons(self, cx) + .when(self.has_focus(cx), |tab_bar| { + tab_bar.end_child({ + let render_tab_buttons = self.render_tab_bar_buttons.clone(); + render_tab_buttons(self, cx) + }) }) .children( self.items @@ -1937,7 +1939,9 @@ impl Render for Pane { }) }), ) - .child(self.render_tab_bar(cx)) + .when(self.active_item().is_some(), |pane| { + pane.child(self.render_tab_bar(cx)) + }) .child({ let has_worktrees = self.project.read(cx).worktrees().next().is_some(); // main content