Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: "Ctrl+Enter" creates commit when Enter is released, not pressed #10742

Merged
merged 6 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather remove both comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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