This commit is contained in:
Anuken
2020-05-29 13:58:57 -04:00
@@ -71,17 +71,20 @@ public class SchematicsDialog extends BaseDialog{
rebuildPane[0] = () -> { rebuildPane[0] = () -> {
t.clear(); t.clear();
int i = 0; int i = 0;
String regex = "[`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?]";
String searchString = search.toLowerCase().replaceAll(regex," ");
if(!schematics.all().contains(s -> search.isEmpty() || s.name().toLowerCase().contains(search.toLowerCase()))){ if(!schematics.all().contains(s -> search.isEmpty() || s.name().toLowerCase().replaceAll(regex," ").contains(searchString))){
t.add("$none"); t.add("$none");
return;
} }
firstSchematic = null; firstSchematic = null;
for(Schematic s : schematics.all()){ for(Schematic s : schematics.all()){
if(!search.isEmpty() && !s.name().toLowerCase().contains(search.toLowerCase())) continue;
if(firstSchematic == null) if(!search.isEmpty() && !s.name().toLowerCase().replaceAll(regex," ").contains(searchString)) continue;
firstSchematic = s; if(firstSchematic == null) firstSchematic = s;
Button[] sel = {null}; Button[] sel = {null};
sel[0] = t.button(b -> { sel[0] = t.button(b -> {