From eec87f17cdaad73a6b6df498588b3977940194bb Mon Sep 17 00:00:00 2001 From: XiaoLinger Date: Mon, 8 Nov 2021 12:39:57 +0000 Subject: [PATCH] merge pull request !29 * feature: use "ctrl+ enter" to apply commit --- src/Views/Widgets/WorkingCopy.xaml | 1 + src/Views/Widgets/WorkingCopy.xaml.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Views/Widgets/WorkingCopy.xaml b/src/Views/Widgets/WorkingCopy.xaml index fa10b3c5..6d80d42a 100644 --- a/src/Views/Widgets/WorkingCopy.xaml +++ b/src/Views/Widgets/WorkingCopy.xaml @@ -179,6 +179,7 @@ AcceptsReturn="True" AcceptsTab="True" TextWrapping="Wrap" + KeyDown="CommitMessageKeyDown" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}" diff --git a/src/Views/Widgets/WorkingCopy.xaml.cs b/src/Views/Widgets/WorkingCopy.xaml.cs index 0bec58f1..d4a2f661 100644 --- a/src/Views/Widgets/WorkingCopy.xaml.cs +++ b/src/Views/Widgets/WorkingCopy.xaml.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; +using System.Windows.Input; namespace SourceGit.Views.Widgets { /// @@ -355,6 +356,14 @@ namespace SourceGit.Views.Widgets { e.Handled = true; } + + private void CommitMessageKeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) + { + Commit(sender, e); + } + } #endregion } }