From 07c780bd724125640d310f1c8f9c8d8d9ece993e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 2 Mar 2022 16:52:35 +0100 Subject: [PATCH] Make pane active when activating one of its items --- crates/workspace/src/pane.rs | 1 + crates/workspace/src/workspace.rs | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 050cd7d555..a4eb6c008e 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -326,6 +326,7 @@ impl Pane { } self.update_active_toolbar(cx); self.focus_active_item(cx); + self.activate(cx); cx.notify(); } } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 0ad3a1e5e3..85d5566e04 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1028,12 +1028,14 @@ impl Workspace { } fn activate_pane(&mut self, pane: ViewHandle, cx: &mut ViewContext) { - self.active_pane = pane; - self.status_bar.update(cx, |status_bar, cx| { - status_bar.set_active_pane(&self.active_pane, cx); - }); - cx.focus(&self.active_pane); - cx.notify(); + if self.active_pane != pane { + self.active_pane = pane; + self.status_bar.update(cx, |status_bar, cx| { + status_bar.set_active_pane(&self.active_pane, cx); + }); + cx.focus(&self.active_pane); + cx.notify(); + } } fn handle_pane_event(