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.

sidebar: Fix focus movement to protect zoomed in panels (#53386)

Danilo Lealc32a7c1f616f
diff --git a/crates/workspace/src/multi_workspace.rs b/crates/workspace/src/multi_workspace.rs
index e9baccb4d93..aad5207e8b8 100644
--- a/crates/workspace/src/multi_workspace.rs
+++ b/crates/workspace/src/multi_workspace.rs
@@ -491,7 +491,15 @@ impl MultiWorkspace {
workspace.set_sidebar_focus_handle(None);
});
}
- self.restore_previous_focus(true, window, cx);
+ let sidebar_has_focus = self
+ .sidebar
+ .as_ref()
+ .is_some_and(|s| s.focus_handle(cx).contains_focused(window, cx));
+ if sidebar_has_focus {
+ self.restore_previous_focus(true, window, cx);
+ } else {
+ self.previous_focus_handle.take();
+ }
self.serialize(cx);
cx.notify();
}