fix option searching

This commit is contained in:
yugecin 2017-01-29 16:53:14 +01:00
parent 49c6542fb4
commit 59ef4b37e5
2 changed files with 7 additions and 14 deletions

View File

@ -1210,7 +1210,7 @@ public class Options {
filtered = false;
return false;
}
filtered = !(displayName.toLowerCase().contains(searchString) || description.toLowerCase().contains(searchString));
filtered = !name.toLowerCase().contains(searchString) && !description.toLowerCase().contains(searchString);
return filtered;
}

View File

@ -870,8 +870,7 @@ public class OptionsOverlay extends OverlayOpsuState {
private void updateSearch() {
OptionTab lastBigSection = null;
boolean lastBigSectionMatches = false;
for (int sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) {
OptionTab section = sections[sectionIndex];
for (OptionTab section : sections) {
boolean sectionMatches = section.name.toLowerCase().contains(lastSearchText);
if (section.options == null) {
lastBigSectionMatches = sectionMatches;
@ -879,23 +878,17 @@ public class OptionsOverlay extends OverlayOpsuState {
section.filtered = true;
continue;
}
boolean allOptionsHidden = true;
for (int optionIndex = 0; optionIndex < section.options.length; optionIndex++) {
GameOption option = section.options[optionIndex];
section.filtered = true;
for (GameOption option : section.options) {
if (lastBigSectionMatches || sectionMatches) {
allOptionsHidden = false;
section.filtered = false;
option.filter(null);
continue;
}
if (!option.filter(lastSearchText)) {
allOptionsHidden = false;
}
}
if (allOptionsHidden) {
section.filtered = true;
} else {
lastBigSection.filtered = false;
section.filtered = false;
lastBigSection.filtered = false;
}
}
}
updateHoverOption(prevMouseX, prevMouseY);