change variable name to AutoCompleteText

This commit is contained in:
Jeremy 2021-12-05 18:40:43 +11:00
parent 1d9bc990b2
commit 02b92c0a2a
3 changed files with 12 additions and 8 deletions

View file

@ -29,7 +29,12 @@ namespace Flow.Launcher.Plugin
/// </summary>
public string ActionKeywordAssigned { get; set; }
public string SuggestionText { get; set; } = string.Empty;
/// <summary>
/// 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.
/// </summary>
public string AutoCompleteText { get; set; }
public string IcoPath
{

View file

@ -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)

View file

@ -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)