Skip to content

Commit 03ae0b8

Browse files
committed
use previous directory command
1 parent 0363cbc commit 03ae0b8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using NotifyIcon = System.Windows.Forms.NotifyIcon;
1919
using Flow.Launcher.Infrastructure;
2020
using Flow.Launcher.Infrastructure.Hotkey;
21+
using Flow.Launcher.Plugin.SharedCommands;
2122

2223
namespace Flow.Launcher
2324
{
@@ -476,7 +477,7 @@ private void OnKeyDown(object sender, KeyEventArgs e)
476477
{
477478
if (_viewModel.SelectedIsFromQueryResults()
478479
&& QueryTextBox.CaretIndex == QueryTextBox.Text.Length
479-
&& !string.IsNullOrEmpty(QueryTextBox.Text) && QueryTextBox.Text.Contains(":\\"))
480+
&& FilesFolders.IsLocationPathString(QueryTextBox.Text))
480481
{
481482

482483
_viewModel.BackspaceCommand.Execute(null);

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using Microsoft.VisualStudio.Threading;
2121
using System.Threading.Channels;
2222
using ISavable = Flow.Launcher.Plugin.ISavable;
23-
using System.IO;
2423

2524
namespace Flow.Launcher.ViewModel
2625
{
@@ -230,7 +229,10 @@ private void InitializeKeyCommands()
230229

231230
BackspaceCommand = new RelayCommand(index =>
232231
{
233-
ChangeQueryText(Path.GetDirectoryName(QueryText));
232+
var path = QueryText;
233+
234+
// GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string
235+
ChangeQueryText(FilesFolders.GetPreviousExistingDirectory(FilesFolders.IsLocationPathString, path.TrimEnd('\\')));
234236
});
235237

236238
LoadContextMenuCommand = new RelayCommand(_ =>

0 commit comments

Comments
 (0)