Skip to content

Commit 5a733d0

Browse files
committed
Initial Tab complete
1 parent 96bcf1b commit 5a733d0

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Flow.Launcher/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
4242
<KeyBinding Key="F1" Command="{Binding StartHelpCommand}" />
4343
<KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" />
44-
<KeyBinding Key="Tab" Command="{Binding SelectNextItemCommand}" />
44+
<KeyBinding Key="Tab" Command="{Binding ReplaceQueryWithResult}" />
4545
<KeyBinding
4646
Key="Tab"
4747
Command="{Binding SelectPrevItemCommand}"

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,22 @@ private void InitializeKeyCommands()
228228
}
229229
});
230230

231+
ReplaceQueryWithResult = new RelayCommand(index =>
232+
{
233+
var results = SelectedResults;
234+
235+
if (index != null)
236+
{
237+
results.SelectedIndex = int.Parse(index.ToString());
238+
}
239+
240+
var result = results.SelectedItem?.Result;
241+
if (result != null) // SelectedItem returns null if selection is empty.
242+
{
243+
ChangeQueryText(result.Title, true);
244+
}
245+
});
246+
231247
LoadContextMenuCommand = new RelayCommand(_ =>
232248
{
233249
if (SelectedIsFromQueryResults())
@@ -383,6 +399,7 @@ private ResultsViewModel SelectedResults
383399
public ICommand OpenSettingCommand { get; set; }
384400
public ICommand ReloadPluginDataCommand { get; set; }
385401
public ICommand ClearQueryCommand { get; private set; }
402+
public ICommand ReplaceQueryWithResult { get; set; }
386403

387404
public string OpenResultCommandModifiers { get; private set; }
388405

0 commit comments

Comments
 (0)