mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[PTRun]Fix null reference issue when clean previous query is on (#19167)
This commit is contained in:
@@ -362,14 +362,14 @@ namespace PowerLauncher.ViewModel
|
||||
/// </summary>
|
||||
/// <param name="queryText">Text that is being queried from user</param>
|
||||
/// <param name="requery">Optional Parameter that if true, will automatically execute a query against the updated text</param>
|
||||
public void ChangeQueryText(string queryText, bool requery = false, QueryTuningOptions tuningOptions = null)
|
||||
public void ChangeQueryText(string queryText, bool requery = false)
|
||||
{
|
||||
SystemQueryText = queryText;
|
||||
|
||||
if (requery)
|
||||
{
|
||||
QueryText = queryText;
|
||||
Query(tuningOptions);
|
||||
Query();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,11 +472,11 @@ namespace PowerLauncher.ViewModel
|
||||
public bool SearchWaitForSlowResults { get; set; }
|
||||
}
|
||||
|
||||
public void Query(QueryTuningOptions options)
|
||||
public void Query()
|
||||
{
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
QueryResults(options);
|
||||
QueryResults();
|
||||
}
|
||||
else if (HistorySelected())
|
||||
{
|
||||
@@ -527,8 +527,9 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private void QueryResults(QueryTuningOptions queryTuning)
|
||||
private void QueryResults()
|
||||
{
|
||||
var queryTuning = GetQueryTuningOptions();
|
||||
var doFinalSort = queryTuning.SearchQueryTuningEnabled && queryTuning.SearchWaitForSlowResults;
|
||||
|
||||
if (!string.IsNullOrEmpty(QueryText))
|
||||
@@ -1157,6 +1158,16 @@ namespace PowerLauncher.ViewModel
|
||||
return _settings.SearchInputDelay;
|
||||
}
|
||||
|
||||
public QueryTuningOptions GetQueryTuningOptions()
|
||||
{
|
||||
return new MainViewModel.QueryTuningOptions
|
||||
{
|
||||
SearchClickedItemWeight = GetSearchClickedItemWeight(),
|
||||
SearchQueryTuningEnabled = GetSearchQueryTuningEnabled(),
|
||||
SearchWaitForSlowResults = GetSearchWaitForSlowResults(),
|
||||
};
|
||||
}
|
||||
|
||||
public int GetSearchClickedItemWeight()
|
||||
{
|
||||
return _settings.SearchClickedItemWeight;
|
||||
|
||||
Reference in New Issue
Block a user