Skip to content

Commit 7df9826

Browse files
committed
Merge branch 'dev' into 240518Adjusthemes
2 parents d35c96d + 7af3bd1 commit 7df9826

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,27 @@ private ResultsViewModel SelectedResults
670670
get { return _selectedResults; }
671671
set
672672
{
673+
var isReturningFromContextMenu = ContextMenuSelected();
673674
_selectedResults = value;
674675
if (SelectedIsFromQueryResults())
675676
{
676677
ContextMenu.Visibility = Visibility.Collapsed;
677678
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+
}
679694
}
680695
else
681696
{

0 commit comments

Comments
 (0)