git_ui: Fix commit and amend not working via keybinds in commit modal (#44690)

Closes #41567

We were using the git panel editor to check the focus where the commit
modal has its only editor.

Release Notes:

- Fixed an issue where commit and amend actions wouldn’t trigger when
using keybinds in the commit modal.
This commit is contained in:
Smit Barmase
2025-12-12 14:41:48 +05:30
committed by GitHub
parent 65130a9ca9
commit 1186b50ca4
2 changed files with 22 additions and 22 deletions
+6 -8
View File
@@ -493,20 +493,18 @@ impl CommitModal {
}
fn on_commit(&mut self, _: &git::Commit, window: &mut Window, cx: &mut Context<Self>) {
if self
.git_panel
.update(cx, |git_panel, cx| git_panel.commit(window, cx))
{
if self.git_panel.update(cx, |git_panel, cx| {
git_panel.commit(&self.commit_editor.focus_handle(cx), window, cx)
}) {
telemetry::event!("Git Committed", source = "Git Modal");
cx.emit(DismissEvent);
}
}
fn on_amend(&mut self, _: &git::Amend, window: &mut Window, cx: &mut Context<Self>) {
if self
.git_panel
.update(cx, |git_panel, cx| git_panel.amend(window, cx))
{
if self.git_panel.update(cx, |git_panel, cx| {
git_panel.amend(&self.commit_editor.focus_handle(cx), window, cx)
}) {
telemetry::event!("Git Amended", source = "Git Modal");
cx.emit(DismissEvent);
}