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);
|
return _unhandledModifiers.HasFlag(modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClearKeyModifier()
|
||||||
|
{
|
||||||
|
_unhandledModifiers = KeyModifiers.None;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnOpened(EventArgs e)
|
protected override void OnOpened(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnOpened(e);
|
base.OnOpened(e);
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace SourceGit.Views
|
||||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||||
|
|
||||||
|
launcher.ClearKeyModifier();
|
||||||
repo.Fetch(startDirectly);
|
repo.Fetch(startDirectly);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,7 @@ namespace SourceGit.Views
|
||||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||||
|
|
||||||
|
launcher.ClearKeyModifier();
|
||||||
repo.Pull(startDirectly);
|
repo.Pull(startDirectly);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +83,7 @@ namespace SourceGit.Views
|
||||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||||
|
|
||||||
|
launcher.ClearKeyModifier();
|
||||||
repo.Push(startDirectly);
|
repo.Push(startDirectly);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +92,16 @@ namespace SourceGit.Views
|
||||||
private void StashAll(object _, RoutedEventArgs e)
|
private void StashAll(object _, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var launcher = this.FindAncestorOfType<Launcher>();
|
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)
|
||||||
e.Handled = true;
|
{
|
||||||
|
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)
|
private void OpenGitFlowMenu(object sender, RoutedEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue