mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
use ResultViewModel to hold constructed suggestion text instead
This commit is contained in:
parent
0fe8c93636
commit
2ba6ce9e87
3 changed files with 16 additions and 4 deletions
|
|
@ -46,7 +46,7 @@ namespace Flow.Launcher.Converters
|
|||
// construct autocomplete with suggestion
|
||||
string _suggestion = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
|
||||
if (string.IsNullOrEmpty(selectedResult.AutoCompleteText))
|
||||
selectedItem.Result.AutoCompleteText = _suggestion;
|
||||
selectedItem.QuerySuggestionText = _suggestion;
|
||||
|
||||
// When user typed lower case and result title is uppercase, we still want to display suggestion
|
||||
return queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
|
||||
|
|
|
|||
|
|
@ -233,14 +233,24 @@ namespace Flow.Launcher.ViewModel
|
|||
var result = SelectedResults.SelectedItem?.Result;
|
||||
if (result != null) // SelectedItem returns null if selection is empty.
|
||||
{
|
||||
string _newText = String.IsNullOrEmpty(result.AutoCompleteText) ? result.Title : result.AutoCompleteText;
|
||||
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)
|
||||
{
|
||||
_newText = result.SubTitle;
|
||||
autoCompleteText = result.SubTitle;
|
||||
}
|
||||
ChangeQueryText(_newText);
|
||||
|
||||
ChangeQueryText(autoCompleteText);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public Result Result { get; }
|
||||
|
||||
public string QuerySuggestionText { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is ResultViewModel r && Result.Equals(r.Result);
|
||||
|
|
|
|||
Loading…
Reference in a new issue