Skip to content

Commit 6ac86fd

Browse files
committed
Fix UpdateCommandPaletteSuggestions
1 parent 8f3bfa0 commit 6ac86fd

1 file changed

Lines changed: 7 additions & 28 deletions

File tree

src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,37 +1104,16 @@ private void UpdateCommandPaletteSuggestions(List<NavigationBarSuggestionItem> n
11041104
});
11051105
}
11061106

1107-
if (!OmnibarCommandPaletteModeSuggestionItems.IntersectBy(newSuggestions, x => x.PrimaryDisplay).Any())
1107+
for (int index = 0; index < newSuggestions.Count; index++)
11081108
{
1109-
for (int index = 0; index < newSuggestions.Count; index++)
1110-
{
1111-
if (index < OmnibarCommandPaletteModeSuggestionItems.Count)
1112-
OmnibarCommandPaletteModeSuggestionItems[index] = newSuggestions[index];
1113-
else
1114-
OmnibarCommandPaletteModeSuggestionItems.Add(newSuggestions[index]);
1115-
}
1116-
1117-
while (OmnibarCommandPaletteModeSuggestionItems.Count > newSuggestions.Count)
1118-
OmnibarCommandPaletteModeSuggestionItems.RemoveAt(OmnibarCommandPaletteModeSuggestionItems.Count - 1);
1109+
if (index < OmnibarCommandPaletteModeSuggestionItems.Count)
1110+
OmnibarCommandPaletteModeSuggestionItems[index] = newSuggestions[index];
1111+
else
1112+
OmnibarCommandPaletteModeSuggestionItems.Add(newSuggestions[index]);
11191113
}
1120-
else
1121-
{
1122-
foreach (var s in OmnibarCommandPaletteModeSuggestionItems.ExceptBy(newSuggestions, x => x.PrimaryDisplay).ToList())
1123-
OmnibarCommandPaletteModeSuggestionItems.Remove(s);
11241114

1125-
for (int index = 0; index < newSuggestions.Count; index++)
1126-
{
1127-
if (OmnibarCommandPaletteModeSuggestionItems.Count > index
1128-
&& OmnibarCommandPaletteModeSuggestionItems[index].PrimaryDisplay == newSuggestions[index].PrimaryDisplay)
1129-
{
1130-
OmnibarCommandPaletteModeSuggestionItems[index] = newSuggestions[index];
1131-
}
1132-
else
1133-
{
1134-
OmnibarCommandPaletteModeSuggestionItems.Insert(index, newSuggestions[index]);
1135-
}
1136-
}
1137-
}
1115+
while (OmnibarCommandPaletteModeSuggestionItems.Count > newSuggestions.Count)
1116+
OmnibarCommandPaletteModeSuggestionItems.RemoveAt(OmnibarCommandPaletteModeSuggestionItems.Count - 1);
11381117
}
11391118

11401119
public async Task PopulateOmnibarSuggestionsForSearchMode()

0 commit comments

Comments
 (0)