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

Closes #23123 

Only close current active_pane should move focus to other pane.

Release Notes:

- N/A
This commit is contained in:
CharlesChen0823
2025-02-10 11:54:06 +02:00
committed by GitHub
parent 6f7f0f30e2
commit 994bea0003
+6 -4
View File
@@ -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;