diff --git a/src/Views/Launcher.axaml b/src/Views/Launcher.axaml index b1d3dfae..303388cd 100644 --- a/src/Views/Launcher.axaml +++ b/src/Views/Launcher.axaml @@ -127,9 +127,7 @@ + PointerPressed="OnCloseCommandPalette"> diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index 3bcb2db5..cb9dca3f 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -189,6 +189,13 @@ namespace SourceGit.Views } } + if (vm.CommandPalette != null) + { + if (e.Key == Key.Escape) + vm.CommandPalette = null; + return; + } + if (e.KeyModifiers.HasFlag(OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control)) { if (e.Key == Key.W) @@ -395,23 +402,6 @@ namespace SourceGit.Views e.Handled = true; } - private void OnCommandPaletteKeyDown(object sender, KeyEventArgs e) - { - if (DataContext is ViewModels.Launcher { CommandPalette: { } } vm) - { - if (e.Key == Key.Escape) - vm.CommandPalette = null; - - e.Route = RoutingStrategies.Direct; - e.Handled = true; - } - } - - private void OnCommandPaletteKeyUp(object sender, KeyEventArgs e) - { - e.Handled = true; - } - private WindowState _lastWindowState = WindowState.Normal; } }