- Add Left/Right Key for context menu.

This commit is contained in:
Dobin Park 2021-10-05 03:33:29 +09:00
parent e201df9619
commit 6c43a48fcf
2 changed files with 24 additions and 0 deletions

View file

@ -47,6 +47,8 @@
<KeyBinding Key="U" Modifiers="Ctrl" Command="{Binding SelectPrevPageCommand}"></KeyBinding>
<KeyBinding Key="Home" Modifiers="Alt" Command="{Binding SelectFirstResultCommand}"></KeyBinding>
<KeyBinding Key="O" Modifiers="Ctrl" Command="{Binding LoadContextMenuCommand}"></KeyBinding>
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}"></KeyBinding>
<KeyBinding Key="Left" Command="{Binding EscCommand}"></KeyBinding>
<KeyBinding Key="H" Modifiers="Ctrl" Command="{Binding LoadHistoryCommand}"></KeyBinding>
<KeyBinding Key="Enter" Modifiers="Ctrl+Shift" Command="{Binding OpenResultCommand}"></KeyBinding>
<KeyBinding Key="Enter" Modifiers="Shift" Command="{Binding LoadContextMenuCommand}"></KeyBinding>

View file

@ -333,6 +333,28 @@ namespace Flow.Launcher
_viewModel.SelectPrevPageCommand.Execute(null);
e.Handled = true;
}
else if (e.Key == Key.Right)
{
int caretPosition = QueryTextBox.CaretIndex;
int queryLength = QueryTextBox.Text.Length;
if (caretPosition == queryLength && queryLength != 0)
{
_viewModel.LoadContextMenuCommand.Execute(null);
e.Handled = true;
}
else { }
}
else if (e.Key == Key.Left)
{
int caretPosition = QueryTextBox.CaretIndex;
int queryLength = QueryTextBox.Text.Length;
if (caretPosition == queryLength && queryLength == 0)
{
_viewModel.EscCommand.Execute(null);
e.Handled = true;
}
else { }
}
}
private void MoveQueryTextToEnd()