diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index ba0b63a52..18a323cdf 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -469,6 +469,15 @@ namespace Flow.Launcher e.Handled = true; } break; + case Key.Back: + if (_viewModel.SelectedIsFromQueryResults() + && QueryTextBox.CaretIndex == QueryTextBox.Text.Length + && !string.IsNullOrEmpty(QueryTextBox.Text) && QueryTextBox.Text.Contains(":\\")) + { + _viewModel.BackspaceCommand.Execute(null); + e.Handled = true; + } + break; default: break; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 1d666426f..f6d55e91f 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -20,7 +20,7 @@ using Flow.Launcher.Infrastructure.Logger; using Microsoft.VisualStudio.Threading; using System.Threading.Channels; using ISavable = Flow.Launcher.Plugin.ISavable; - +using System.IO; namespace Flow.Launcher.ViewModel { @@ -228,6 +228,11 @@ namespace Flow.Launcher.ViewModel } }); + BackspaceCommand = new RelayCommand(index => + { + ChangeQueryText(Path.GetDirectoryName(QueryText)); + }); + LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) @@ -371,6 +376,7 @@ namespace Flow.Launcher.ViewModel public double MainWindowWidth => _settings.WindowSize; public ICommand EscCommand { get; set; } + public ICommand BackspaceCommand { get; set; } public ICommand SelectNextItemCommand { get; set; } public ICommand SelectPrevItemCommand { get; set; } public ICommand SelectNextPageCommand { get; set; }