diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index d5fcabace05..a1a1307587f 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -57,9 +57,11 @@ internal static void OnHotkey(object sender, HotkeyEventArgs e) { if (!ShouldIgnoreHotkeys()) { - UpdateLastQUeryMode(); + if (settings.LastQueryMode == LastQueryMode.Empty) + mainViewModel.ChangeQueryText(string.Empty); mainViewModel.ToggleFlowLauncher(); + e.Handled = true; } } @@ -72,25 +74,6 @@ private static bool ShouldIgnoreHotkeys() return settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); } - private static void UpdateLastQUeryMode() - { - switch(settings.LastQueryMode) - { - case LastQueryMode.Empty: - mainViewModel.ChangeQueryText(string.Empty); - break; - case LastQueryMode.Preserved: - mainViewModel.LastQuerySelected = true; - break; - case LastQueryMode.Selected: - mainViewModel.LastQuerySelected = false; - break; - default: - throw new ArgumentException($"wrong LastQueryMode: <{settings.LastQueryMode}>"); - - } - } - internal static void LoadCustomPluginHotkey() { if (settings.CustomPluginHotkeys == null) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 5fab812e6e2..34bb62d0ccf 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -84,11 +84,9 @@ private void OnLoaded(object sender, RoutedEventArgs _) QueryTextBox.Focus(); UpdatePosition(); _settings.ActivateTimes++; - if (!_viewModel.LastQuerySelected) - { - QueryTextBox.SelectAll(); - _viewModel.LastQuerySelected = true; - } + + if (_settings.LastQueryMode == LastQueryMode.Selected) + QueryTextBox.SelectAll(); if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused) { diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 5b9706a32a5..6b0fcc6555b 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -293,7 +293,6 @@ public void ChangeQueryText(string queryText) QueryText = queryText; } - public bool LastQuerySelected { get; set; } public bool QueryTextCursorMovedToEnd { get; set; } private ResultsViewModel _selectedResults;