From ee65485197d60a5f0158ba2097c4cabe3fd923c6 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 16:55:36 -0400 Subject: [PATCH] Fix flicker when reverting last hunk from the project diff view (cherry-pick #26706) (#26712) Cherry-picked 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 Co-authored-by: Conrad Irwin --- 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>> {