From 214fec86872bc139321d503b00ec43c8abf8d420 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 20 Jan 2022 20:04:48 +1100 Subject: [PATCH 1/4] add support for action keyword when using Ctrl + Backspace --- Flow.Launcher/MainWindow.xaml.cs | 14 +++++++++----- Flow.Launcher/ViewModel/MainViewModel.cs | 8 ++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index f3360d9a9..02b27cf28 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -506,12 +506,16 @@ namespace Flow.Launcher if (specialKeyState.CtrlPressed) { if (_viewModel.SelectedIsFromQueryResults() - && QueryTextBox.CaretIndex == QueryTextBox.Text.Length - && FilesFolders.IsLocationPathString(QueryTextBox.Text)) + && QueryTextBox.CaretIndex == QueryTextBox.Text.Length) { - - _viewModel.BackspaceCommand.Execute(null); - e.Handled = true; + var queryWithoutActionKeyword = + QueryBuilder.Build(QueryTextBox.Text.Trim(), PluginManager.NonGlobalPlugins).Search; + + if (FilesFolders.IsLocationPathString(queryWithoutActionKeyword)) + { + _viewModel.BackspaceCommand.Execute(null); + e.Handled = true; + } } } break; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index a3691e98e..2fa9bf1a2 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -254,10 +254,14 @@ namespace Flow.Launcher.ViewModel BackspaceCommand = new RelayCommand(index => { - var path = QueryText; + var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins); // GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string - ChangeQueryText(FilesFolders.GetPreviousExistingDirectory(FilesFolders.IsLocationPathString, path.TrimEnd('\\'))); + var path = FilesFolders.GetPreviousExistingDirectory((_) => true, query.Search.TrimEnd('\\')); + + var actionKeyword = string.IsNullOrEmpty(query.ActionKeyword) ? string.Empty : $"{query.ActionKeyword} "; + + ChangeQueryText($"{actionKeyword}{path}"); }); LoadContextMenuCommand = new RelayCommand(_ => From 622fa20023f909f8cec8368b82679577f7c58a4c Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 20 Jan 2022 20:13:27 +1100 Subject: [PATCH 2/4] add back to previous dir hotkey to readme --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f44263ff1..c00a484dd 100644 --- a/README.md +++ b/README.md @@ -215,17 +215,18 @@ And you can download Ctrl +i | Open Setting Window | | F5 | Reload All Plugin Data & Window Search Index | | Ctrl + h | Open Query History | -| Ctrl + Backspace | Back to previous directory | +| Ctrl + Backspace | Back to Previous Directory | ## System Command List From 9161de2fe01c0d71f4140c6f5ac51f0c8e07fbd2 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 20 Jan 2022 20:23:13 +1100 Subject: [PATCH 4/4] formatting --- Flow.Launcher/ViewModel/ResultsViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs index 01a19d871..db24825d0 100644 --- a/Flow.Launcher/ViewModel/ResultsViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs @@ -310,4 +310,4 @@ namespace Flow.Launcher.ViewModel } } } -} \ No newline at end of file +}