Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Flow.Launcher.Plugin/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@
public PreviewInfo Preview { get; set; } = PreviewInfo.Default;

/// <summary>
/// Determines if the user selection count should be added to the score. This can be useful when set to false to allow the result sequence order to be the same everytime instead of changing based on selection.

Check warning on line 242 in Flow.Launcher.Plugin/Result.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`everytime` is not a recognized word. (unrecognized-spelling)
/// </summary>
public bool AddSelectedCount { get; set; } = true;

/// <summary>
/// The key to identify the record. This is used when FL checks whether the result is the topmost record. Or FL calculates the hashcode of the result for user selected records.

Check warning on line 247 in Flow.Launcher.Plugin/Result.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`hashcode` is not a recognized word. (unrecognized-spelling)
/// This can be useful when your plugin will change the Title or SubTitle of the result dynamically.
/// If the plugin does not specific this, FL just uses Title and SubTitle to identify this result.
/// Note: Because old data does not have this key, we should use null as the default value for consistency.
Expand All @@ -257,6 +257,12 @@
/// </summary>
public bool ShowBadge { get; set; } = false;

/// <summary>
/// This holds the text which can be shown as a query suggestion.
/// </summary>
/// <remarks>When a value is not set, the <see cref="Title"/> will be used.</remarks>
public string QuerySuggestionText { get; set; }

/// <summary>
/// Run this result, asynchronously
/// </summary>
Expand Down
8 changes: 5 additions & 3 deletions Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
// values[0] is TextBox: The textbox displaying the autocomplete suggestion

Check warning on line 17 in Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`textbox` is not a recognized word. (unrecognized-spelling)
// values[1] is ResultViewModel: Currently selected item in the list
// values[2] is string: Query text
if (
Expand All @@ -33,15 +33,17 @@
{
var selectedResult = selectedItem.Result;
var selectedResultActionKeyword = string.IsNullOrEmpty(selectedResult.ActionKeywordAssigned) ? "" : selectedResult.ActionKeywordAssigned + " ";
var selectedResultPossibleSuggestion = selectedResultActionKeyword + selectedResult.Title;
var selectedResultPossibleSuggestion = selectedResultActionKeyword +
(string.IsNullOrEmpty(selectedResult.QuerySuggestionText) ?
selectedResult.Title :
selectedResult.QuerySuggestionText);

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
selectedItem.QuerySuggestionText = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
selectedItem.QuerySuggestionText = string.Concat(queryText, selectedResultPossibleSuggestion.AsSpan(queryText.Length));

// Check if Text will be larger than our QueryTextBox
Typeface typeface = new Typeface(queryTextBox.FontFamily, queryTextBox.FontStyle, queryTextBox.FontWeight, queryTextBox.FontStretch);
Expand Down
Loading