mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 15:17:44 +08:00
Adds logic to prioritize selecting exact mod acronyms when they are searched
This commit is contained in:
parent
bfad281f62
commit
2ef8720590
@ -590,9 +590,16 @@ namespace osu.Game.Overlays.Mods
|
||||
return true;
|
||||
}
|
||||
|
||||
//matchingMod ensures that if an exact mod acronym is typed, it will be selected when Select is pressed (as opposed to being prioritized in arbitrary column order)
|
||||
ModState? firstMod = columnFlow.Columns.OfType<ModColumn>().FirstOrDefault(m => m.IsPresent)?.AvailableMods.FirstOrDefault(x => x.Visible);
|
||||
ModState? matchingMod = columnFlow.Columns.OfType<ModColumn>().SelectMany(m => m.AvailableMods).FirstOrDefault(x => x.Mod.Acronym.Equals(SearchTerm, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (firstMod is not null)
|
||||
if (matchingMod is not null)
|
||||
{
|
||||
matchingMod.Active.Value = !matchingMod.Active.Value;
|
||||
SearchTextBox.SelectAll();
|
||||
}
|
||||
else if (firstMod is not null)
|
||||
{
|
||||
firstMod.Active.Value = !firstMod.Active.Value;
|
||||
SearchTextBox.SelectAll();
|
||||
|
Loading…
Reference in New Issue
Block a user