diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs index 38e0706fb1896b6e4bd90dcc141063d22def0b04..8c98ad8df70ec5be54371a47d24cdb8e04f81d3d 100644 --- a/crates/workspace2/src/pane.rs +++ b/crates/workspace2/src/pane.rs @@ -159,6 +159,7 @@ pub struct Pane { items: Vec>, activation_history: Vec, zoomed: bool, + was_focused: bool, active_item_index: usize, last_focused_view_by_item: HashMap, autoscroll: bool, @@ -317,6 +318,7 @@ impl Pane { focus_handle: cx.focus_handle(), items: Vec::new(), activation_history: Vec::new(), + was_focused: false, zoomed: false, active_item_index: 0, last_focused_view_by_item: Default::default(), @@ -413,7 +415,8 @@ impl Pane { } fn focus_in(&mut self, cx: &mut ViewContext) { - if !self.has_focus(cx) { + if !self.was_focused { + self.was_focused = true; cx.emit(Event::Focus); cx.notify(); } @@ -444,6 +447,7 @@ impl Pane { } fn focus_out(&mut self, cx: &mut ViewContext) { + self.was_focused = false; self.toolbar.update(cx, |toolbar, cx| { toolbar.focus_changed(false, cx); });