mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'empty_query' of https://github.com/Jack251970/Flow.Launcher into empty_query
This commit is contained in:
commit
fe25764221
1 changed files with 25 additions and 7 deletions
|
|
@ -34,6 +34,7 @@ namespace Flow.Launcher.ViewModel
|
|||
private bool _isQueryRunning;
|
||||
private Query _lastQuery;
|
||||
private string _queryTextBeforeLeaveResults;
|
||||
private string _ignoredQueryText = null;
|
||||
|
||||
private readonly FlowLauncherJsonStorage<History> _historyItemsStorage;
|
||||
private readonly FlowLauncherJsonStorage<UserSelectedRecord> _userSelectedRecordStorage;
|
||||
|
|
@ -736,6 +737,9 @@ namespace Flow.Launcher.ViewModel
|
|||
if (isReturningFromContextMenu)
|
||||
{
|
||||
_queryText = _queryTextBeforeLeaveResults;
|
||||
// When executing OnPropertyChanged, QueryTextBox_TextChanged1 and Query will be called
|
||||
// So we need to ignore it so that we will not call Query again
|
||||
_ignoredQueryText = _queryText;
|
||||
OnPropertyChanged(nameof(QueryText));
|
||||
QueryTextCursorMovedToEnd = true;
|
||||
}
|
||||
|
|
@ -1087,6 +1091,20 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public void Query(bool searchDelay, bool isReQuery = false)
|
||||
{
|
||||
if (_ignoredQueryText != null)
|
||||
{
|
||||
if (_ignoredQueryText == QueryText)
|
||||
{
|
||||
_ignoredQueryText = null;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If _ignoredQueryText does not match current QueryText, we should still execute Query
|
||||
_ignoredQueryText = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (QueryResultsSelected())
|
||||
{
|
||||
_ = QueryResultsAsync(searchDelay, isReQuery);
|
||||
|
|
@ -1192,7 +1210,7 @@ namespace Flow.Launcher.ViewModel
|
|||
OriginQuery = new Query { RawQuery = h.Query },
|
||||
Action = _ =>
|
||||
{
|
||||
SelectedResults = Results;
|
||||
App.API.BackToQueryResults();
|
||||
App.API.ChangeQuery(h.Query);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1518,11 +1536,14 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
// Show expanded builtin shortcuts
|
||||
if (queryChanged)
|
||||
{
|
||||
// show expanded builtin shortcuts
|
||||
// use private field to avoid infinite recursion
|
||||
// Use private field to avoid infinite recursion
|
||||
_queryText = queryBuilderTmp.ToString();
|
||||
// When executing OnPropertyChanged, QueryTextBox_TextChanged1 and Query will be called
|
||||
// So we need to ignore it so that we will not call Query again
|
||||
_ignoredQueryText = _queryText;
|
||||
OnPropertyChanged(nameof(QueryText));
|
||||
}
|
||||
}
|
||||
|
|
@ -1704,10 +1725,7 @@ namespace Flow.Launcher.ViewModel
|
|||
await CloseExternalPreviewAsync();
|
||||
}
|
||||
|
||||
if (!QueryResultsSelected())
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
BackToQueryResults();
|
||||
|
||||
switch (Settings.LastQueryMode)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue