@@ -34,8 +34,6 @@ public partial class MainViewModel : BaseModel, ISavable
34
34
35
35
private bool _isQueryRunning ;
36
36
private Query _lastQuery ;
37
- private Result lastContextMenuResult = new Result ( ) ;
38
- private List < Result > lastContextMenuResults = new List < Result > ( ) ;
39
37
private string _queryTextBeforeLeaveResults ;
40
38
41
39
private readonly FlowLauncherJsonStorage < History > _historyItemsStorage ;
@@ -398,11 +396,15 @@ private async Task OpenResultAsync(string index)
398
396
} )
399
397
. ConfigureAwait ( false ) ;
400
398
401
-
402
399
if ( SelectedIsFromQueryResults ( ) )
403
400
{
404
401
_userSelectedRecord . Add ( result ) ;
405
- _history . Add ( result . OriginQuery . RawQuery ) ;
402
+ // origin query is null when user select the context menu item directly of one item from query list
403
+ // so we don't want to add it to history
404
+ if ( result . OriginQuery != null )
405
+ {
406
+ _history . Add ( result . OriginQuery . RawQuery ) ;
407
+ }
406
408
lastHistoryIndex = 1 ;
407
409
}
408
410
@@ -986,19 +988,10 @@ private void QueryContextMenu()
986
988
if ( selected != null ) // SelectedItem returns null if selection is empty.
987
989
{
988
990
List < Result > results ;
989
- if ( selected == lastContextMenuResult )
990
- {
991
- results = lastContextMenuResults ;
992
- }
993
- else
994
- {
995
- results = PluginManager . GetContextMenusForPlugin ( selected ) ;
996
- lastContextMenuResults = results ;
997
- lastContextMenuResult = selected ;
998
- results . Add ( ContextMenuTopMost ( selected ) ) ;
999
- results . Add ( ContextMenuPluginInfo ( selected . PluginID ) ) ;
1000
- }
1001
991
992
+ results = PluginManager . GetContextMenusForPlugin ( selected ) ;
993
+ results . Add ( ContextMenuTopMost ( selected ) ) ;
994
+ results . Add ( ContextMenuPluginInfo ( selected . PluginID ) ) ;
1002
995
1003
996
if ( ! string . IsNullOrEmpty ( query ) )
1004
997
{
@@ -1273,6 +1266,8 @@ private Result ContextMenuTopMost(Result result)
1273
1266
{
1274
1267
_topMostRecord . Remove ( result ) ;
1275
1268
App . API . ShowMsg ( InternationalizationManager . Instance . GetTranslation ( "success" ) ) ;
1269
+ App . API . BackToQueryResults ( ) ;
1270
+ App . API . ReQuery ( ) ;
1276
1271
return false ;
1277
1272
}
1278
1273
} ;
@@ -1289,6 +1284,8 @@ private Result ContextMenuTopMost(Result result)
1289
1284
{
1290
1285
_topMostRecord . AddOrUpdate ( result ) ;
1291
1286
App . API . ShowMsg ( InternationalizationManager . Instance . GetTranslation ( "success" ) ) ;
1287
+ App . API . BackToQueryResults ( ) ;
1288
+ App . API . ReQuery ( ) ;
1292
1289
return false ;
1293
1290
}
1294
1291
} ;
@@ -1377,8 +1374,6 @@ public async void Hide()
1377
1374
lastHistoryIndex = 1 ;
1378
1375
// Trick for no delay
1379
1376
MainWindowOpacity = 0 ;
1380
- lastContextMenuResult = new Result ( ) ;
1381
- lastContextMenuResults = new List < Result > ( ) ;
1382
1377
1383
1378
if ( ExternalPreviewVisible )
1384
1379
CloseExternalPreview ( ) ;
0 commit comments