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.

Fix panic in activate_pane_in_direction (#21948)

Cole Miller672fc7683214
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 2a9c05b737f..be7c13d5931 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -2960,11 +2960,13 @@ impl Workspace {
match target {
Some(ActivateInDirectionTarget::Pane(pane)) => cx.focus_view(&pane),
Some(ActivateInDirectionTarget::Dock(dock)) => {
- if let Some(panel) = dock.read(cx).active_panel() {
- panel.focus_handle(cx).focus(cx);
- } else {
- log::error!("Could not find a focus target when in switching focus in {direction} direction for a {:?} dock", dock.read(cx).position());
- }
+ dock.update(cx, |dock, cx| {
+ if let Some(panel) = dock.active_panel() {
+ panel.focus_handle(cx).focus(cx);
+ } else {
+ log::error!("Could not find a focus target when in switching focus in {direction} direction for a {:?} dock", dock.position());
+ }
+ });
}
None => {}
}