Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix focus bug with new docks
Mikayla Makie80ab5f096ba
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rsindex 2919bb7cd44..e722b3be6ac 100644--- a/crates/workspace/src/pane.rs+++ b/crates/workspace/src/pane.rs@@ -306,15 +306,6 @@ impl Pane {&self.workspace}- pub fn is_active(&self) -> bool {- self.is_active- }-- pub fn set_active(&mut self, is_active: bool, cx: &mut ViewContext<Self>) {- self.is_active = is_active;- cx.notify();- }-pub fn has_focus(&self) -> bool {self.has_focus}@@ -1129,7 +1120,7 @@ impl Pane {None};- let pane_active = self.is_active;+ let pane_active = self.has_focus;enum Tabs {}let mut row = Flex::row().scrollable::<Tabs>(1, autoscroll, cx);@@ -1508,7 +1499,7 @@ impl View for Pane {let mut tab_row = Flex::row().with_child(self.render_tabs(cx).flex(1., true).into_any_named("tabs"));- if self.is_active {+ if self.has_focus {let render_tab_bar_buttons = self.render_tab_bar_buttons.clone();tab_row.add_child((render_tab_bar_buttons)(self, cx)@@ -1599,6 +1590,7 @@ impl View for Pane {if !self.has_focus {self.has_focus = true;cx.emit(Event::Focus);+ cx.notify();}self.toolbar.update(cx, |toolbar, cx| {@@ -1633,6 +1625,7 @@ impl View for Pane {self.toolbar.update(cx, |toolbar, cx| {toolbar.pane_focus_update(false, cx);});+ cx.notify();}fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext) {diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 53240a9a73d..e51a0bf812c 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -1945,11 +1945,7 @@ impl Workspace {fn handle_pane_focused(&mut self, pane: ViewHandle<Pane>, cx: &mut ViewContext<Self>) {if self.active_pane != pane {- self.active_pane- .update(cx, |pane, cx| pane.set_active(false, cx));self.active_pane = pane.clone();- self.active_pane- .update(cx, |pane, cx| pane.set_active(true, cx));self.status_bar.update(cx, |status_bar, cx| {status_bar.set_active_pane(&self.active_pane, cx);});@@ -2868,7 +2864,7 @@ impl Workspace {})}).collect::<Vec<_>>(),- pane.is_active(),+ pane.has_focus(),)};