mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-11 23:57:21 -08:00
enhance: clear unhandled key modifer before running command (#748)
Some checks are pending
Some checks are pending
This commit is contained in:
parent
1872148d98
commit
e224f59ea7
2 changed files with 18 additions and 2 deletions
|
@ -72,6 +72,11 @@ namespace SourceGit.Views
|
|||
return _unhandledModifiers.HasFlag(modifier);
|
||||
}
|
||||
|
||||
public void ClearKeyModifier()
|
||||
{
|
||||
_unhandledModifiers = KeyModifiers.None;
|
||||
}
|
||||
|
||||
protected override void OnOpened(EventArgs e)
|
||||
{
|
||||
base.OnOpened(e);
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace SourceGit.Views
|
|||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.Fetch(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -67,6 +68,7 @@ namespace SourceGit.Views
|
|||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.Pull(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -81,6 +83,7 @@ namespace SourceGit.Views
|
|||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.Push(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -89,9 +92,17 @@ namespace SourceGit.Views
|
|||
private void StashAll(object _, RoutedEventArgs e)
|
||||
{
|
||||
var launcher = this.FindAncestorOfType<Launcher>();
|
||||
(DataContext as ViewModels.Repository)?.StashAll(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
|
||||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.StashAll(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenGitFlowMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue