Skip to content

Commit 9f4b474

Browse files
committed
Fix rebase
1 parent 4b65de9 commit 9f4b474

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,22 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidCommand.GetLocalizedRes
309309
}
310310
else if (Omnibar.CurrentSelectedMode == OmnibarSearchMode)
311311
{
312-
ContentPageContext.ShellPage?.SubmitSearch(args.Text);
312+
var shellPage = ContentPageContext.ShellPage;
313+
314+
if (args.Item is SuggestionModel item && !string.IsNullOrWhiteSpace(item.ItemPath) && shellPage is not null)
315+
await NavigationHelpers.OpenPath(item.ItemPath, shellPage);
316+
else
317+
{
318+
var searchQuery = args.Item is SuggestionModel x && !string.IsNullOrWhiteSpace(x.Name)
319+
? x.Name
320+
: args.Text;
321+
322+
shellPage?.SubmitSearch(searchQuery); // use the resolved shellPage for consistency
323+
ViewModel.SaveSearchQueryToList(searchQuery);
324+
}
325+
326+
(MainPageViewModel.SelectedTabItem?.TabItemContent as Control)?.Focus(FocusState.Programmatic);
327+
return;
313328
}
314329
}
315330

0 commit comments

Comments
 (0)