@@ -1220,31 +1220,21 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12201220 _updateSource ? . Cancel ( ) ;
12211221
12221222 var query = await ConstructQueryAsync ( QueryText , Settings . CustomShortcuts , Settings . BuiltinShortcuts ) ;
1223- var homeQuery = query == null ;
1224- ICollection < PluginPair > plugins = Array . Empty < PluginPair > ( ) ;
12251223
12261224 if ( query == null ) // shortcut expanded
12271225 {
1228- if ( Settings . ShowHomePage )
1229- {
1230- plugins = PluginManager . ValidPluginsForHomeQuery ( query ) ;
1231- }
1232-
1233- if ( plugins . Count == 0 )
1234- {
1235- // Hide and clear results again because running query may show and add some results
1236- Results . Visibility = Visibility . Collapsed ;
1237- Results . Clear ( ) ;
1226+ // Hide and clear results again because running query may show and add some results
1227+ Results . Visibility = Visibility . Collapsed ;
1228+ Results . Clear ( ) ;
12381229
1239- // Reset plugin icon
1240- PluginIconPath = null ;
1241- PluginIconSource = null ;
1242- SearchIconVisibility = Visibility . Visible ;
1230+ // Reset plugin icon
1231+ PluginIconPath = null ;
1232+ PluginIconSource = null ;
1233+ SearchIconVisibility = Visibility . Visible ;
12431234
1244- // Hide progress bar again because running query may set this to visible
1245- ProgressBarVisibility = Visibility . Hidden ;
1246- return ;
1247- }
1235+ // Hide progress bar again because running query may set this to visible
1236+ ProgressBarVisibility = Visibility . Hidden ;
1237+ return ;
12481238 }
12491239
12501240 _updateSource = new CancellationTokenSource ( ) ;
@@ -1258,16 +1248,22 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12581248 if ( _updateSource . Token . IsCancellationRequested ) return ;
12591249
12601250 // Update the query's IsReQuery property to true if this is a re-query
1261- if ( ! homeQuery ) query . IsReQuery = isReQuery ;
1251+ query . IsReQuery = isReQuery ;
12621252
12631253 // handle the exclusiveness of plugin using action keyword
12641254 RemoveOldQueryResults ( query ) ;
12651255
12661256 _lastQuery = query ;
12671257
1258+ var homeQuery = query . RawQuery == string . Empty ;
1259+ ICollection < PluginPair > plugins = Array . Empty < PluginPair > ( ) ;
12681260 if ( homeQuery )
12691261 {
1270- // Do not show plugin icon if this is a home query
1262+ if ( Settings . ShowHomePage )
1263+ {
1264+ plugins = PluginManager . ValidPluginsForHomeQuery ( ) ;
1265+ }
1266+
12711267 PluginIconPath = null ;
12721268 PluginIconSource = null ;
12731269 SearchIconVisibility = Visibility . Visible ;
@@ -1317,18 +1313,17 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13171313 Task [ ] tasks ;
13181314 if ( homeQuery )
13191315 {
1320- var homeTasks = plugins . Select ( plugin => plugin . Metadata . HomeDisabled switch
1316+ tasks = plugins . Select ( plugin => plugin . Metadata . HomeDisabled switch
13211317 {
13221318 false => QueryTaskAsync ( plugin , _updateSource . Token ) ,
13231319 true => Task . CompletedTask
1324- } ) . ToList ( ) ;
1320+ } ) . ToArray ( ) ;
13251321
1322+ // Query history results for home page firstly so it will be put on top of the results
13261323 if ( Settings . ShowHistoryResultsForHomePage )
13271324 {
1328- homeTasks . Add ( QueryHistoryTaskAsync ( ) ) ;
1325+ await QueryHistoryTaskAsync ( ) ;
13291326 }
1330-
1331- tasks = homeTasks . ToArray ( ) ;
13321327 }
13331328 else
13341329 {
@@ -1465,7 +1460,7 @@ private async Task<Query> ConstructQueryAsync(string queryText, IEnumerable<Cust
14651460 {
14661461 if ( string . IsNullOrWhiteSpace ( queryText ) )
14671462 {
1468- return null ;
1463+ return QueryBuilder . Build ( string . Empty , PluginManager . NonGlobalPlugins ) ;
14691464 }
14701465
14711466 var queryBuilder = new StringBuilder ( queryText ) ;
0 commit comments