From 8361c32a348c7e8c944daa023a3dff1c011f030b Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 13 Mar 2025 12:49:18 -0600 Subject: [PATCH] Fix flicker when reverting last hunk from the project diff view (#26706) Closes #26696 Closes #ISSUE Release Notes: - git: Fix flicker when reverting last hunk in project diff view --- crates/git_ui/src/project_diff.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index f0fcd488e0d5bf2f8fed257930875624db44fc3c..db3302116ea6f1f1cc3cfcf5dd2b0f1e7a9e9504 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -308,7 +308,7 @@ impl ProjectDiff { fn handle_editor_event( &mut self, - _: &Entity, + editor: &Entity, event: &EditorEvent, window: &mut Window, cx: &mut Context, @@ -330,6 +330,11 @@ impl ProjectDiff { } _ => {} } + if editor.focus_handle(cx).contains_focused(window, cx) { + if self.multibuffer.read(cx).is_empty() { + self.focus_handle.focus(window) + } + } } fn load_buffers(&mut self, cx: &mut Context) -> Vec>> {