4
4
using CommunityToolkit . WinUI ;
5
5
using Files . App . Controls ;
6
6
using Files . Shared . Helpers ;
7
+ using Microsoft . Extensions . Logging ;
7
8
using Microsoft . UI . Dispatching ;
8
9
using Microsoft . UI . Xaml ;
9
10
using Microsoft . UI . Xaml . Controls ;
@@ -242,7 +243,7 @@ public bool IsOmnibarFocused
242
243
243
244
if ( value )
244
245
{
245
- switch ( OmnibarCurrentSelectedMode . Name )
246
+ switch ( OmnibarCurrentSelectedModeName )
246
247
{
247
248
case OmnibarPathModeName :
248
249
PathText =
@@ -263,11 +264,34 @@ public bool IsOmnibarFocused
263
264
}
264
265
}
265
266
266
- private OmnibarMode _OmnibarCurrentSelectedMode ;
267
- public OmnibarMode OmnibarCurrentSelectedMode { get => _OmnibarCurrentSelectedMode ; set => SetProperty ( ref _OmnibarCurrentSelectedMode , value ) ; }
268
-
269
- private string _OmnibarCurrentSelectedModeName ;
270
- public string OmnibarCurrentSelectedModeName { get => _OmnibarCurrentSelectedModeName ; set => SetProperty ( ref _OmnibarCurrentSelectedModeName , value ) ; }
267
+ private string _OmnibarCurrentSelectedModeName = OmnibarPathModeName ;
268
+ public string OmnibarCurrentSelectedModeName
269
+ {
270
+ get => _OmnibarCurrentSelectedModeName ;
271
+ set
272
+ {
273
+ if ( SetProperty ( ref _OmnibarCurrentSelectedModeName , value ) && IsOmnibarFocused )
274
+ {
275
+ switch ( value )
276
+ {
277
+ case OmnibarPathModeName :
278
+ PathText =
279
+ string . IsNullOrEmpty ( ContentPageContext . ShellPage ? . ShellViewModel ? . WorkingDirectory )
280
+ ? Constants . UserEnvironmentPaths . HomePath
281
+ : ContentPageContext . ShellPage . ShellViewModel . WorkingDirectory ;
282
+ _ = PopulateOmnibarSuggestionsForPathMode ( ) ;
283
+ break ;
284
+ case OmnibarPaletteModeName :
285
+ PopulateOmnibarSuggestionsForCommandPaletteMode ( ) ;
286
+ break ;
287
+ case OmnibarSearchModeName :
288
+ break ;
289
+ default :
290
+ break ;
291
+ }
292
+ }
293
+ }
294
+ }
271
295
272
296
private CurrentInstanceViewModel _InstanceViewModel ;
273
297
public CurrentInstanceViewModel InstanceViewModel
@@ -738,7 +762,6 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidItemDialogTitle.GetLoca
738
762
}
739
763
740
764
PathControlDisplayText = ContentPageContext . ShellPage . ShellViewModel . WorkingDirectory ;
741
- IsOmnibarFocused = false ;
742
765
}
743
766
744
767
public void PathBoxItem_PreviewKeyDown ( object sender , KeyRoutedEventArgs e )
@@ -1077,6 +1100,8 @@ private static async Task<bool> LaunchApplicationFromPath(string currentInput, s
1077
1100
1078
1101
public async Task PopulateOmnibarSuggestionsForPathMode ( )
1079
1102
{
1103
+ PathModeSuggestionItems . Clear ( ) ;
1104
+
1080
1105
var result = await SafetyExtensions . IgnoreExceptions ( ( Func < Task < bool > > ) ( async ( ) =>
1081
1106
{
1082
1107
List < OmnibarPathModeSuggestionModel > ? newSuggestions = [ ] ;
@@ -1117,9 +1142,7 @@ public async Task PopulateOmnibarSuggestionsForPathMode()
1117
1142
1118
1143
// If there are no suggestions, show "No suggestions"
1119
1144
if ( newSuggestions . Count is 0 )
1120
- {
1121
- AddNoResultsItem ( ) ;
1122
- }
1145
+ return false ;
1123
1146
1124
1147
// Check whether at least one item is in common between the old and the new suggestions
1125
1148
// since the suggestions popup becoming empty causes flickering
0 commit comments