From 02b92c0a2aec8ffd01e29ee36cd4f3051fe3792f Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sun, 5 Dec 2021 18:40:43 +1100 Subject: [PATCH] change variable name to AutoCompleteText --- Flow.Launcher.Plugin/Result.cs | 7 ++++++- .../Converters/QuerySuggestionBoxConverter.cs | 11 +++++------ Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 55c14b2c7..29f8198ab 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -29,7 +29,12 @@ namespace Flow.Launcher.Plugin /// public string ActionKeywordAssigned { get; set; } - public string SuggestionText { get; set; } = string.Empty; + /// + /// 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 { diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index c4533c019..6aa1facbc 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -43,13 +43,12 @@ namespace Flow.Launcher.Converters if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase)) return string.Empty; - // When user typed lower case and result title is uppercase, we still want to display suggestion - + // construct autocomplete with suggestion string _suggestion = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length); - if (String.IsNullOrEmpty(selectedResult.SuggestionText)) - { - selectedItem.Result.SuggestionText = _suggestion; - } + if (string.IsNullOrEmpty(selectedResult.AutoCompleteText)) + selectedItem.Result.AutoCompleteText = _suggestion; + + // When user typed lower case and result title is uppercase, we still want to display suggestion return queryText + selectedResultPossibleSuggestion.Substring(queryText.Length); } catch (Exception e) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index a8394cc6b..984bbecc7 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -235,7 +235,7 @@ namespace Flow.Launcher.ViewModel var result = results.SelectedItem?.Result; if (result != null) // SelectedItem returns null if selection is empty. { - string _newText = String.IsNullOrEmpty(result.SuggestionText) ? result.Title : result.SuggestionText; + string _newText = String.IsNullOrEmpty(result.AutoCompleteText) ? result.Title : result.AutoCompleteText; var SpecialKeyState = GlobalHotkey.Instance.CheckModifiers(); if (SpecialKeyState.ShiftPressed)