@@ -515,8 +515,11 @@ private async Task OpenResultAsync(string index)
515515 return ;
516516 }
517517
518+ var hideWindow = false ;
519+ var isDialogJumpLeftClick = _isDialogJump && Settings . DialogJumpResultBehaviour == DialogJumpResultBehaviours . LeftClick ;
520+
518521 // For Dialog Jump and left click mode, we need to navigate to the path
519- if ( _isDialogJump && Settings . DialogJumpResultBehaviour == DialogJumpResultBehaviours . LeftClick )
522+ if ( isDialogJumpLeftClick )
520523 {
521524 if ( result is DialogJumpResult dialogJumpResult )
522525 {
@@ -531,26 +534,30 @@ private async Task OpenResultAsync(string index)
531534 // For query mode, we execute the result
532535 else
533536 {
534- var hideWindow = await result . ExecuteAsync ( new ActionContext
537+ hideWindow = await result . ExecuteAsync ( new ActionContext
535538 {
536539 // not null means pressing modifier key + number, should ignore the modifier key
537540 SpecialKeyState = index is not null ? SpecialKeyState . Default : GlobalHotkey . CheckModifiers ( )
538541 } ) . ConfigureAwait ( false ) ;
539-
540- if ( hideWindow )
541- {
542- Hide ( ) ;
543- }
544542 }
545543
546- // Record user selected result for result ranking
547- _userSelectedRecord . Add ( result ) ;
548- // Add item to history only if it is from results but not context menu or history
544+ // New history result must be recorded before Hide() is called, otherwise when in 'Empty Last Query' query style mode
545+ // the QueryAsync call will reconstruct the result list without the new item.
546+ // Also, add item to history only if it is from results but not context menu or history.
549547 if ( queryResultsSelected )
550548 {
551549 _history . Add ( result ) ;
552550 lastHistoryIndex = 1 ;
553551 }
552+
553+ // Only hide for query results (not Dialog Jump left-click mode)
554+ if ( ! isDialogJumpLeftClick && hideWindow )
555+ {
556+ Hide ( ) ;
557+ }
558+
559+ // Record user selected result for result ranking
560+ _userSelectedRecord . Add ( result ) ;
554561 }
555562
556563 private static IReadOnlyList < Result > DeepCloneResults ( IReadOnlyList < Result > results , bool isDialogJump , CancellationToken token = default )
0 commit comments