diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs
index 833ada9cda1..29f8198ab44 100644
--- a/Flow.Launcher.Plugin/Result.cs
+++ b/Flow.Launcher.Plugin/Result.cs
@@ -29,6 +29,13 @@ public class Result
///
public string ActionKeywordAssigned { get; set; }
+ ///
+ /// This holds the text which can be provided by plugin to help Flow autocomplete text
+ /// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have
+ /// the default constructed autocomplete text (result's Title), or the text provided here if not empty.
+ ///
+ public string AutoCompleteText { get; set; }
+
public string IcoPath
{
get { return _icoPath; }
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index c70796a6d4e..acbbf6971e1 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -43,8 +43,11 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase))
return string.Empty;
+ // For AutocompleteQueryCommand.
// When user typed lower case and result title is uppercase, we still want to display suggestion
- return queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
+ selectedItem.QuerySuggestionText = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
+
+ return selectedItem.QuerySuggestionText;
}
catch (Exception e)
{
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index dd897965075..1f449421522 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -41,10 +41,12 @@
-
+
+ {
+ var result = SelectedResults.SelectedItem?.Result;
+ if (result != null) // SelectedItem returns null if selection is empty.
+ {
+ var autoCompleteText = result.Title;
+
+ if (!string.IsNullOrEmpty(result.AutoCompleteText))
+ {
+ autoCompleteText = result.AutoCompleteText;
+ }
+ else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText))
+ {
+ autoCompleteText = SelectedResults.SelectedItem.QuerySuggestionText;
+ }
+
+ var SpecialKeyState = GlobalHotkey.Instance.CheckModifiers();
+ if (SpecialKeyState.ShiftPressed)
+ {
+ autoCompleteText = result.SubTitle;
+ }
+
+ ChangeQueryText(autoCompleteText);
+ }
+ });
+
LoadContextMenuCommand = new RelayCommand(_ =>
{
if (SelectedIsFromQueryResults())
@@ -287,7 +313,6 @@ private void InitializeKeyCommands()
public bool GameModeStatus { get; set; }
private string _queryText;
-
public string QueryText
{
get => _queryText;
@@ -383,6 +408,7 @@ private ResultsViewModel SelectedResults
public ICommand OpenSettingCommand { get; set; }
public ICommand ReloadPluginDataCommand { get; set; }
public ICommand ClearQueryCommand { get; private set; }
+ public ICommand AutocompleteQueryCommand { get; set; }
public string OpenResultCommandModifiers { get; private set; }
diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs
index ed3d842e3b9..908de0c0993 100644
--- a/Flow.Launcher/ViewModel/ResultViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultViewModel.cs
@@ -142,6 +142,8 @@ private async ValueTask LoadImageAsync()
public Result Result { get; }
+ public string QuerySuggestionText { get; set; }
+
public override bool Equals(object obj)
{
return obj is ResultViewModel r && Result.Equals(r.Result);