From 430bd83e4d8c7b2cf63538318f92daa7f3f696a2 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 17 Mar 2025 10:58:04 -0700 Subject: [PATCH] Don't open the commit editor when staging last hunk (#26939) Closes #26880 Release Notes: - Removed a behavior where staging the last hunk in the project diff would open the commit modal. --- crates/editor/src/editor.rs | 2 -- crates/git_ui/src/project_diff.rs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0c863cfab89d4735682012e2efdd5e5c5fb6ac93..a5f87fef6c1b03dc65e6666e85d684b44318851c 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -14020,8 +14020,6 @@ impl Editor { self.change_selections(Some(autoscroll), window, cx, |s| { s.select_ranges([destination..destination]); }); - } else if all_diff_hunks_expanded { - window.dispatch_action(::git::ExpandCommitEditor.boxed_clone(), cx); } } diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index ec43467181b861d051221e9e38fc16175a27ecdf..40168aeffacd8e16c049b3f3e35f2d332f696cb0 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -806,6 +806,7 @@ impl ProjectDiffToolbar { fn project_diff(&self, _: &App) -> Option> { self.project_diff.as_ref()?.upgrade() } + fn dispatch_action(&self, action: &dyn Action, window: &mut Window, cx: &mut Context) { if let Some(project_diff) = self.project_diff(cx) { project_diff.focus_handle(cx).focus(window);