Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
using NotifyIcon = System.Windows.Forms.NotifyIcon;
using Flow.Launcher.Infrastructure;
using System.Windows.Media;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Plugin.SharedCommands;

namespace Flow.Launcher
{
Expand Down Expand Up @@ -499,6 +501,20 @@ private void OnKeyDown(object sender, KeyEventArgs e)
e.Handled = true;
}
break;
case Key.Back:
var specialKeyState = GlobalHotkey.CheckModifiers();
if (specialKeyState.CtrlPressed)
{
if (_viewModel.SelectedIsFromQueryResults()
&& QueryTextBox.CaretIndex == QueryTextBox.Text.Length
&& FilesFolders.IsLocationPathString(QueryTextBox.Text))
{

_viewModel.BackspaceCommand.Execute(null);
e.Handled = true;
}
}
break;
default:
break;

Expand Down
11 changes: 10 additions & 1 deletion Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage;
using Flow.Launcher.Infrastructure.Logger;
using Microsoft.VisualStudio.Threading;
using System.Threading.Channels;
using ISavable = Flow.Launcher.Plugin.ISavable;


namespace Flow.Launcher.ViewModel
{
public class MainViewModel : BaseModel, ISavable
Expand Down Expand Up @@ -252,6 +252,14 @@ private void InitializeKeyCommands()
}
});

BackspaceCommand = new RelayCommand(index =>
{
var path = QueryText;

// GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string
ChangeQueryText(FilesFolders.GetPreviousExistingDirectory(FilesFolders.IsLocationPathString, path.TrimEnd('\\')));
});

LoadContextMenuCommand = new RelayCommand(_ =>
{
if (SelectedIsFromQueryResults())
Expand Down Expand Up @@ -398,6 +406,7 @@ private ResultsViewModel SelectedResults
public string PluginIconPath { get; set; } = null;

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; }
Expand Down