Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

workspace: Fix pane focus transfer when closing another pane (#23175)

CharlesChen0823994bea00032d
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 78c950b5355..e4e3a7c783e 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -4442,10 +4442,12 @@ impl Workspace {
if let Some(focus_on) = focus_on {
focus_on.update(cx, |pane, cx| window.focus(&pane.focus_handle(cx)));
} else {
- self.panes
- .last()
- .unwrap()
- .update(cx, |pane, cx| window.focus(&pane.focus_handle(cx)));
+ if self.active_pane() == pane {
+ self.panes
+ .last()
+ .unwrap()
+ .update(cx, |pane, cx| window.focus(&pane.focus_handle(cx)));
+ }
}
if self.last_active_center_pane == Some(pane.downgrade()) {
self.last_active_center_pane = None;