File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -670,12 +670,27 @@ private ResultsViewModel SelectedResults
670
670
get { return _selectedResults ; }
671
671
set
672
672
{
673
+ var isReturningFromContextMenu = ContextMenuSelected ( ) ;
673
674
_selectedResults = value ;
674
675
if ( SelectedIsFromQueryResults ( ) )
675
676
{
676
677
ContextMenu . Visibility = Visibility . Collapsed ;
677
678
History . Visibility = Visibility . Collapsed ;
678
- ChangeQueryText ( _queryTextBeforeLeaveResults ) ;
679
+
680
+ // QueryText setter (used in ChangeQueryText) runs the query again, resetting the selected
681
+ // result from the one that was selected before going into the context menu to the first result.
682
+ // The code below correctly restores QueryText and puts the text caret at the end without
683
+ // running the query again when returning from the context menu.
684
+ if ( isReturningFromContextMenu )
685
+ {
686
+ _queryText = _queryTextBeforeLeaveResults ;
687
+ OnPropertyChanged ( nameof ( QueryText ) ) ;
688
+ QueryTextCursorMovedToEnd = true ;
689
+ }
690
+ else
691
+ {
692
+ ChangeQueryText ( _queryTextBeforeLeaveResults ) ;
693
+ }
679
694
}
680
695
else
681
696
{
You can’t perform that action at this time.
0 commit comments