diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index e522ea85957..1b5b6bc7178 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -137,7 +137,7 @@ impl WindowInvalidator { self.inner.borrow_mut().dirty_views = views; } - pub fn not_painting(&self) -> bool { + pub fn not_drawing(&self) -> bool { self.inner.borrow().draw_phase == DrawPhase::None } @@ -1035,7 +1035,7 @@ impl Window { /// Mark the window as dirty, scheduling it to be redrawn on the next frame. pub fn refresh(&mut self) { - if self.invalidator.not_painting() { + if self.invalidator.not_drawing() { self.refreshing = true; self.invalidator.set_dirty(true); } diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index f161501e23c..4480f4acbfc 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -582,6 +582,11 @@ impl Pane { if let Some(active_item) = self.active_item() { if self.focus_handle.is_focused(window) { + // Schedule a redraw next frame, so that the focus changes below take effect + cx.on_next_frame(window, |_, _, cx| { + cx.notify(); + }); + // Pane was focused directly. We need to either focus a view inside the active item, // or focus the active item itself if let Some(weak_last_focus_handle) =