From 7039018de16123241870f4e7b4299904925773bc 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:28 -0400 Subject: [PATCH] Fix flicker when reverting last hunk from the project diff view (cherry-pick #26706) (#26711) 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 f993880ed972fa80bb4d2a3be0d5f8aed06ec16a..1e9acf03dd5c2e609e2549c42678f8b1d5db9295 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>> {