mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Do not query when back from the context menu
This commit is contained in:
parent
62e1252ac4
commit
b1197858de
1 changed files with 18 additions and 0 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;
|
||||
|
|
@ -730,6 +731,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;
|
||||
}
|
||||
|
|
@ -1076,6 +1080,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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue