merge pull request !29

* feature<Commit>: use "ctrl+ enter" to apply commit
This commit is contained in:
XiaoLinger 2021-11-08 12:39:57 +00:00 committed by leo
parent 73057a4adc
commit eec87f17cd
2 changed files with 10 additions and 0 deletions

View file

@ -179,6 +179,7 @@
AcceptsReturn="True" AcceptsReturn="True"
AcceptsTab="True" AcceptsTab="True"
TextWrapping="Wrap" TextWrapping="Wrap"
KeyDown="CommitMessageKeyDown"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"
Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}" Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}"

View file

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace SourceGit.Views.Widgets { namespace SourceGit.Views.Widgets {
/// <summary> /// <summary>
@ -355,6 +356,14 @@ namespace SourceGit.Views.Widgets {
e.Handled = true; 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 #endregion
} }
} }