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
1212
1313 internal bool IsTopMost ( Result result )
1414 {
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
1517 if ( records . IsEmpty || result . OriginQuery == null ||
1618 ! records . TryGetValue ( result . OriginQuery . RawQuery , out var value ) )
1719 {
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ private static int GenerateResultHashCode(Result result)
5151
5252 private static int GenerateQueryAndResultHashCode ( Query query , Result result )
5353 {
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
5456 if ( query == null )
5557 {
5658 return GenerateResultHashCode ( result ) ;
Original file line number Diff line number Diff line change @@ -396,11 +396,15 @@ private async Task OpenResultAsync(string index)
396396 } )
397397 . ConfigureAwait ( false ) ;
398398
399-
400399 if ( SelectedIsFromQueryResults ( ) )
401400 {
402401 _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+ }
404408 lastHistoryIndex = 1 ;
405409 }
406410
@@ -985,9 +989,9 @@ private void QueryContextMenu()
985989 {
986990 List < Result > results ;
987991
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 ) ) ;
991995
992996 if ( ! string . IsNullOrEmpty ( query ) )
993997 {
You can’t perform that action at this time.
0 commit comments