From 948871969fd9603c69c85412c63a8f746566b6b3 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 29 Sep 2023 14:35:21 -0700 Subject: [PATCH] Fix active view update when center pane is not focused --- crates/workspace/src/workspace.rs | 36 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 3b50157774..44a70f9a08 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2980,30 +2980,28 @@ impl Workspace { } fn update_active_view_for_followers(&self, cx: &AppContext) { - let item = self - .active_item(cx) - .and_then(|item| item.to_followable_item_handle(cx)); - if let Some(item) = item { - self.update_followers( - item.is_project_item(cx), - proto::update_followers::Variant::UpdateActiveView(proto::UpdateActiveView { + let mut is_project_item = true; + let mut update = proto::UpdateActiveView::default(); + if self.active_pane.read(cx).has_focus() { + let item = self + .active_item(cx) + .and_then(|item| item.to_followable_item_handle(cx)); + if let Some(item) = item { + is_project_item = item.is_project_item(cx); + update = proto::UpdateActiveView { id: item .remote_id(&self.app_state.client, cx) .map(|id| id.to_proto()), leader_id: self.leader_for_pane(&self.active_pane), - }), - cx, - ); - } else { - self.update_followers( - true, - proto::update_followers::Variant::UpdateActiveView(proto::UpdateActiveView { - id: None, - leader_id: None, - }), - cx, - ); + }; + } } + + self.update_followers( + is_project_item, + proto::update_followers::Variant::UpdateActiveView(update), + cx, + ); } fn update_followers(