Skip to content

Commit

Permalink
Fix: "Ctrl+Enter" creates commit when Enter is released, not pressed (#…
Browse files Browse the repository at this point in the history
…10742)

* Fix KeyUp event to KeyDown in order to handle commit action
* Sign contributors.txt
  • Loading branch information
RauulDev committed Feb 26, 2023
1 parent 88f95ae commit 04dafda
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
1 change: 0 additions & 1 deletion GitUI/CommandsDialogs/FormCommit.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions GitUI/CommandsDialogs/FormCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ protected override CommandStatus ExecuteCommand(int cmd)
case Command.Refresh: RescanChanges(); return true;
case Command.SelectNext:
case Command.SelectNext_AlternativeHotkey1:
case Command.SelectNext_AlternativeHotkey2: MoveSelection(1); return true;
case Command.SelectNext_AlternativeHotkey2: MoveSelection(1); return true;
case Command.SelectPrevious:
case Command.SelectPrevious_AlternativeHotkey1:
case Command.SelectPrevious_AlternativeHotkey2: MoveSelection(-1); return true;
Expand Down Expand Up @@ -2818,26 +2818,16 @@ private void ViewFileHistoryMenuItem_Click(object sender, EventArgs e)
}
}

private void Message_KeyUp(object sender, KeyEventArgs e)
{
// Ctrl + Enter = Commit
if (e.Control && e.KeyCode == Keys.Enter)
{
ExecuteCommitCommand();
e.Handled = true;
}
}

private void ExecuteCommitCommand()
{
CheckForStagedAndCommit(amend: Amend.Checked, push: false, resetAuthor: Amend.Checked && ResetAuthor.Checked);
}

private void Message_KeyDown(object sender, KeyEventArgs e)
{
// Prevent adding a line break when all we want is to commit
if (e.Control && e.KeyCode == Keys.Enter)
{
ExecuteCommitCommand();
e.Handled = true;
}
}
Expand Down
1 change: 1 addition & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,4 @@ YYYY/MM/DD, github id, Full name, email
2022/11/30, SaumyaBhushan, Saumya, saumya@knoldus.com
2022/12/15, siyavash1984,Siyavash Khojasteh, khojasteh(at)outlook.com
2023/01/27, MaxKoll, Maximilian Koll, maximiliankoll(at)web(dot)de
2023/02/24, RauulDev, Raul Molina, remolina7@gmail.com

0 comments on commit 04dafda

Please sign in to comment.