Skip to content

Commit 214fec8

Browse files
committed
add support for action keyword when using Ctrl + Backspace
1 parent ba205ad commit 214fec8

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,16 @@ private void OnKeyDown(object sender, KeyEventArgs e)
506506
if (specialKeyState.CtrlPressed)
507507
{
508508
if (_viewModel.SelectedIsFromQueryResults()
509-
&& QueryTextBox.CaretIndex == QueryTextBox.Text.Length
510-
&& FilesFolders.IsLocationPathString(QueryTextBox.Text))
509+
&& QueryTextBox.CaretIndex == QueryTextBox.Text.Length)
511510
{
512-
513-
_viewModel.BackspaceCommand.Execute(null);
514-
e.Handled = true;
511+
var queryWithoutActionKeyword =
512+
QueryBuilder.Build(QueryTextBox.Text.Trim(), PluginManager.NonGlobalPlugins).Search;
513+
514+
if (FilesFolders.IsLocationPathString(queryWithoutActionKeyword))
515+
{
516+
_viewModel.BackspaceCommand.Execute(null);
517+
e.Handled = true;
518+
}
515519
}
516520
}
517521
break;

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,14 @@ private void InitializeKeyCommands()
254254

255255
BackspaceCommand = new RelayCommand(index =>
256256
{
257-
var path = QueryText;
257+
var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins);
258258

259259
// GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string
260-
ChangeQueryText(FilesFolders.GetPreviousExistingDirectory(FilesFolders.IsLocationPathString, path.TrimEnd('\\')));
260+
var path = FilesFolders.GetPreviousExistingDirectory((_) => true, query.Search.TrimEnd('\\'));
261+
262+
var actionKeyword = string.IsNullOrEmpty(query.ActionKeyword) ? string.Empty : $"{query.ActionKeyword} ";
263+
264+
ChangeQueryText($"{actionKeyword}{path}");
261265
});
262266

263267
LoadContextMenuCommand = new RelayCommand(_ =>

0 commit comments

Comments
 (0)