File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ public class TopMostRecord
12
12
13
13
internal bool IsTopMost ( Result result )
14
14
{
15
+ // origin query is null when user select the context menu item directly of one item from query list
16
+ // in this case, we do not need to check if the result is top most
15
17
if ( records . IsEmpty || result . OriginQuery == null ||
16
18
! records . TryGetValue ( result . OriginQuery . RawQuery , out var value ) )
17
19
{
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ private static int GenerateResultHashCode(Result result)
51
51
52
52
private static int GenerateQueryAndResultHashCode ( Query query , Result result )
53
53
{
54
+ // query is null when user select the context menu item directly of one item from query list
55
+ // so we only need to consider the result
54
56
if ( query == null )
55
57
{
56
58
return GenerateResultHashCode ( result ) ;
Original file line number Diff line number Diff line change @@ -396,11 +396,15 @@ private async Task OpenResultAsync(string index)
396
396
} )
397
397
. ConfigureAwait ( false ) ;
398
398
399
-
400
399
if ( SelectedIsFromQueryResults ( ) )
401
400
{
402
401
_userSelectedRecord . Add ( result ) ;
403
- _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
+ }
404
408
lastHistoryIndex = 1 ;
405
409
}
406
410
@@ -985,9 +989,9 @@ private void QueryContextMenu()
985
989
{
986
990
List < Result > results ;
987
991
988
- results = PluginManager . GetContextMenusForPlugin ( selected ) ;
989
- results . Add ( ContextMenuTopMost ( selected ) ) ;
990
- results . Add ( ContextMenuPluginInfo ( selected . PluginID ) ) ;
992
+ results = PluginManager . GetContextMenusForPlugin ( selected ) ;
993
+ results . Add ( ContextMenuTopMost ( selected ) ) ;
994
+ results . Add ( ContextMenuPluginInfo ( selected . PluginID ) ) ;
991
995
992
996
if ( ! string . IsNullOrEmpty ( query ) )
993
997
{
You can’t perform that action at this time.
0 commit comments