Fix active view update when center pane is not focused

This commit is contained in:
Max Brunsfeld 2023-09-29 14:35:21 -07:00
parent 55da5bc25d
commit 948871969f

View file

@ -2980,32 +2980,30 @@ impl Workspace {
} }
fn update_active_view_for_followers(&self, cx: &AppContext) { fn update_active_view_for_followers(&self, cx: &AppContext) {
let mut is_project_item = true;
let mut update = proto::UpdateActiveView::default();
if self.active_pane.read(cx).has_focus() {
let item = self let item = self
.active_item(cx) .active_item(cx)
.and_then(|item| item.to_followable_item_handle(cx)); .and_then(|item| item.to_followable_item_handle(cx));
if let Some(item) = item { if let Some(item) = item {
self.update_followers( is_project_item = item.is_project_item(cx);
item.is_project_item(cx), update = proto::UpdateActiveView {
proto::update_followers::Variant::UpdateActiveView(proto::UpdateActiveView {
id: item id: item
.remote_id(&self.app_state.client, cx) .remote_id(&self.app_state.client, cx)
.map(|id| id.to_proto()), .map(|id| id.to_proto()),
leader_id: self.leader_for_pane(&self.active_pane), 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( fn update_followers(
&self, &self,
project_only: bool, project_only: bool,