Skip to content

Commit

Permalink
Fix KeyUp event to KeyDown in order to handle commit action
Browse files Browse the repository at this point in the history
  • Loading branch information
rmolina committed Feb 24, 2023
1 parent fc704e2 commit b8d175c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions GitUI/CommandsDialogs/FormCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,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 @@ -2804,16 +2804,6 @@ 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);
Expand All @@ -2822,8 +2812,10 @@ private void ExecuteCommitCommand()
private void Message_KeyDown(object sender, KeyEventArgs e)
{
// Prevent adding a line break when all we want is to commit
// Ctrl + Enter = Commit
if (e.Control && e.KeyCode == Keys.Enter)
{
ExecuteCommitCommand();
e.Handled = true;
}
}
Expand Down

0 comments on commit b8d175c

Please sign in to comment.