enhance: hotkeys

* add `Shift+Ctrl+Tab` (`⌘+⌥+←` on macOS) to go to previous page
* use `ESC` to cancel commit searching
* enable `AutoFocusBehaviour` on `CommitChanges` and `RevisionFiles` tab
This commit is contained in:
leo 2024-05-06 10:22:13 +08:00
parent 16741c21e6
commit b651835de0
7 changed files with 46 additions and 16 deletions

View file

@ -114,12 +114,19 @@ namespace SourceGit.Views
return;
}
else if ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Alt) && e.Key == Key.Right) ||
(!OperatingSystem.IsMacOS() && e.Key == Key.Tab))
(!OperatingSystem.IsMacOS() && !e.KeyModifiers.HasFlag(KeyModifiers.Shift) && e.Key == Key.Tab))
{
vm.GotoNextTab();
e.Handled = true;
return;
}
else if ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Alt) && e.Key == Key.Left) ||
(!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Shift) && e.Key == Key.Tab))
{
vm.GotoPrevTab();
e.Handled = true;
return;
}
else if (vm.ActivePage.Data is ViewModels.Repository repo)
{
if (e.Key == Key.D1 || e.Key == Key.NumPad1)
@ -142,7 +149,7 @@ namespace SourceGit.Views
}
else if (e.Key == Key.F)
{
repo.IsSearching = !repo.IsSearching;
repo.IsSearching = true;
e.Handled = true;
return;
}
@ -151,6 +158,12 @@ namespace SourceGit.Views
else if (e.Key == Key.Escape)
{
vm.ActivePage.CancelPopup();
if (vm.ActivePage.Data is ViewModels.Repository repo)
{
repo.IsSearching = false;
}
e.Handled = true;
return;
}