mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve distinguish between home query and global query
This commit is contained in:
parent
21d6ec20d4
commit
28b8cb6013
3 changed files with 14 additions and 7 deletions
|
|
@ -16,8 +16,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
Search = string.Empty,
|
||||
RawQuery = string.Empty,
|
||||
SearchTerms = Array.Empty<string>(),
|
||||
// must use null because we need to distinguish between home query and global query
|
||||
ActionKeyword = null
|
||||
ActionKeyword = string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ namespace Flow.Launcher.Plugin
|
|||
/// <summary>
|
||||
/// The action keyword part of this query.
|
||||
/// For global plugins this value will be empty.
|
||||
/// For home query this value will be null.
|
||||
/// </summary>
|
||||
public string ActionKeyword { get; init; }
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
private bool _isQueryRunning;
|
||||
private Query _lastQuery;
|
||||
private bool _lastHomeQuery;
|
||||
private string _queryTextBeforeLeaveResults;
|
||||
private string _ignoredQueryText = null;
|
||||
|
||||
|
|
@ -1261,6 +1262,8 @@ namespace Flow.Launcher.ViewModel
|
|||
return;
|
||||
}
|
||||
|
||||
var homeQuery = query.RawQuery == string.Empty;
|
||||
|
||||
_updateSource = new CancellationTokenSource();
|
||||
|
||||
ProgressBarVisibility = Visibility.Hidden;
|
||||
|
|
@ -1275,11 +1278,11 @@ namespace Flow.Launcher.ViewModel
|
|||
query.IsReQuery = isReQuery;
|
||||
|
||||
// handle the exclusiveness of plugin using action keyword
|
||||
RemoveOldQueryResults(query);
|
||||
RemoveOldQueryResults(query, homeQuery);
|
||||
|
||||
_lastQuery = query;
|
||||
_lastHomeQuery = homeQuery;
|
||||
|
||||
var homeQuery = query.RawQuery == string.Empty;
|
||||
ICollection<PluginPair> plugins = Array.Empty<PluginPair>();
|
||||
if (homeQuery)
|
||||
{
|
||||
|
|
@ -1524,9 +1527,15 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private void RemoveOldQueryResults(Query query)
|
||||
private void RemoveOldQueryResults(Query query, bool homeQuery)
|
||||
{
|
||||
if (_lastQuery?.ActionKeyword != query?.ActionKeyword)
|
||||
// If last or current query is home query, we need to clear the results
|
||||
if (_lastHomeQuery || homeQuery)
|
||||
{
|
||||
Results.Clear();
|
||||
}
|
||||
// If last and current query are not home query, we need to check action keyword
|
||||
else if (_lastQuery?.ActionKeyword != query?.ActionKeyword)
|
||||
{
|
||||
Results.Clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue