From 78ce479496f271499be87f8633928897d75a58cb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 18 Feb 2022 16:31:52 +0100 Subject: [PATCH] Notify toolbars if active item changes independently of visibility --- crates/workspace/src/pane.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index cca3ee48b4..c1f34c94c7 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -449,14 +449,11 @@ impl Pane { } fn update_active_toolbar(&mut self, cx: &mut ViewContext) { - if let Some(type_id) = self.active_toolbar_type { - if let Some(toolbar) = self.toolbars.get(&type_id) { - self.active_toolbar_visible = toolbar.active_item_changed( - self.item_views - .get(self.active_item_index) - .map(|i| i.1.clone()), - cx, - ); + let active_item = self.item_views.get(self.active_item_index); + for (toolbar_type_id, toolbar) in &self.toolbars { + let visible = toolbar.active_item_changed(active_item.map(|i| i.1.clone()), cx); + if Some(*toolbar_type_id) == self.active_toolbar_type { + self.active_toolbar_visible = visible; } } }