diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 4866c0deae6..1d71e88d940 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -461,8 +461,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) break; case Key.Right: if (_viewModel.QueryResultsSelected() - && QueryTextBox.CaretIndex == QueryTextBox.Text.Length - && !string.IsNullOrEmpty(QueryTextBox.Text)) + && QueryTextBox.CaretIndex == QueryTextBox.Text.Length) { _viewModel.LoadContextMenuCommand.Execute(null); e.Handled = true; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 920e5be256c..2dfd161a3e2 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -897,6 +897,7 @@ private ResultsViewModel SelectedResults // so we need manually call Query() // http://stackoverflow.com/posts/25895769/revisions QueryText = string.Empty; + // When we are changing query because selected results are changed to history or context menu, // we should not delay the query Query(false); @@ -1220,22 +1221,25 @@ public void QueryResults() public void Query(bool searchDelay, bool isReQuery = false) { - if (_ignoredQueryText != null) + if (QueryResultsSelected()) { - if (_ignoredQueryText == QueryText) - { - _ignoredQueryText = null; - return; - } - else + // We use this to skip creating a new result set and keep the old results. + // This matching is used for programmatic QueryText changes (not user typing), + // such as when returning to the results from the context menu + if (_ignoredQueryText != null) { - // If _ignoredQueryText does not match current QueryText, we should still execute Query - _ignoredQueryText = null; + if (_ignoredQueryText == QueryText) + { + _ignoredQueryText = null; + return; + } + else + { + // If _ignoredQueryText does not match current QueryText, we should still execute Query + _ignoredQueryText = null; + } } - } - if (QueryResultsSelected()) - { _ = QueryResultsAsync(searchDelay, isReQuery); } else if (ContextMenuSelected())