use previous directory command

This commit is contained in:
Jeremy 2022-01-20 07:43:00 +11:00
parent 0363cbcf74
commit 03ae0b868e
2 changed files with 6 additions and 3 deletions

View file

@ -18,6 +18,7 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using NotifyIcon = System.Windows.Forms.NotifyIcon;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Plugin.SharedCommands;
namespace Flow.Launcher
{
@ -476,7 +477,7 @@ namespace Flow.Launcher
{
if (_viewModel.SelectedIsFromQueryResults()
&& QueryTextBox.CaretIndex == QueryTextBox.Text.Length
&& !string.IsNullOrEmpty(QueryTextBox.Text) && QueryTextBox.Text.Contains(":\\"))
&& FilesFolders.IsLocationPathString(QueryTextBox.Text))
{
_viewModel.BackspaceCommand.Execute(null);

View file

@ -20,7 +20,6 @@ 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
{
@ -230,7 +229,10 @@ namespace Flow.Launcher.ViewModel
BackspaceCommand = new RelayCommand(index =>
{
ChangeQueryText(Path.GetDirectoryName(QueryText));
var path = QueryText;
// GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string
ChangeQueryText(FilesFolders.GetPreviousExistingDirectory(FilesFolders.IsLocationPathString, path.TrimEnd('\\')));
});
LoadContextMenuCommand = new RelayCommand(_ =>