@@ -1220,31 +1220,21 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
1220
1220
_updateSource ? . Cancel ( ) ;
1221
1221
1222
1222
var query = await ConstructQueryAsync ( QueryText , Settings . CustomShortcuts , Settings . BuiltinShortcuts ) ;
1223
- var homeQuery = query == null ;
1224
- ICollection < PluginPair > plugins = Array . Empty < PluginPair > ( ) ;
1225
1223
1226
1224
if ( query == null ) // shortcut expanded
1227
1225
{
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 ( ) ;
1238
1229
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 ;
1243
1234
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 ;
1248
1238
}
1249
1239
1250
1240
_updateSource = new CancellationTokenSource ( ) ;
@@ -1258,16 +1248,22 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
1258
1248
if ( _updateSource . Token . IsCancellationRequested ) return ;
1259
1249
1260
1250
// Update the query's IsReQuery property to true if this is a re-query
1261
- if ( ! homeQuery ) query . IsReQuery = isReQuery ;
1251
+ query . IsReQuery = isReQuery ;
1262
1252
1263
1253
// handle the exclusiveness of plugin using action keyword
1264
1254
RemoveOldQueryResults ( query ) ;
1265
1255
1266
1256
_lastQuery = query ;
1267
1257
1258
+ var homeQuery = query . RawQuery == string . Empty ;
1259
+ ICollection < PluginPair > plugins = Array . Empty < PluginPair > ( ) ;
1268
1260
if ( homeQuery )
1269
1261
{
1270
- // Do not show plugin icon if this is a home query
1262
+ if ( Settings . ShowHomePage )
1263
+ {
1264
+ plugins = PluginManager . ValidPluginsForHomeQuery ( ) ;
1265
+ }
1266
+
1271
1267
PluginIconPath = null ;
1272
1268
PluginIconSource = null ;
1273
1269
SearchIconVisibility = Visibility . Visible ;
@@ -1317,18 +1313,17 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
1317
1313
Task [ ] tasks ;
1318
1314
if ( homeQuery )
1319
1315
{
1320
- var homeTasks = plugins . Select ( plugin => plugin . Metadata . HomeDisabled switch
1316
+ tasks = plugins . Select ( plugin => plugin . Metadata . HomeDisabled switch
1321
1317
{
1322
1318
false => QueryTaskAsync ( plugin , _updateSource . Token ) ,
1323
1319
true => Task . CompletedTask
1324
- } ) . ToList ( ) ;
1320
+ } ) . ToArray ( ) ;
1325
1321
1322
+ // Query history results for home page firstly so it will be put on top of the results
1326
1323
if ( Settings . ShowHistoryResultsForHomePage )
1327
1324
{
1328
- homeTasks . Add ( QueryHistoryTaskAsync ( ) ) ;
1325
+ await QueryHistoryTaskAsync ( ) ;
1329
1326
}
1330
-
1331
- tasks = homeTasks . ToArray ( ) ;
1332
1327
}
1333
1328
else
1334
1329
{
@@ -1465,7 +1460,7 @@ private async Task<Query> ConstructQueryAsync(string queryText, IEnumerable<Cust
1465
1460
{
1466
1461
if ( string . IsNullOrWhiteSpace ( queryText ) )
1467
1462
{
1468
- return null ;
1463
+ return QueryBuilder . Build ( string . Empty , PluginManager . NonGlobalPlugins ) ;
1469
1464
}
1470
1465
1471
1466
var queryBuilder = new StringBuilder ( queryText ) ;
0 commit comments