Skip to content

Commit

Permalink
fix subset filter
Browse files Browse the repository at this point in the history
  • Loading branch information
slprime committed Aug 31, 2024
1 parent 42c80ea commit 4ad89e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/codechicken/nei/NEIClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public String getButtonText() {
});

tag.getTag("inventory.search.subsetsSearchMode").setComment("Search mode for Item Subsets (prefix: %)")
.getIntValue(2);
.getIntValue(1);
API.addOption(new OptionCycled("inventory.search.subsetsSearchMode", 3, true) {

@Override
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/codechicken/nei/SubsetWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected void slotClicked(int slot, int button, int mx, int my, int count) {
if (slot < sorted.size()) {
SubsetTag tag = sorted.get(slot);
if (NEIClientUtils.shiftKey()) {
LayoutManager.searchField.setText("%" + tag.fullname);
LayoutManager.searchField.setText("%" + tag.fullname.replaceAll("\\s+", ""));
} else if (button == 0 && count >= 2) {
SubsetWidget.showOnly(tag);
} else {
Expand Down Expand Up @@ -175,7 +175,7 @@ public String parent() {
private SubsetTag getTag(String name) {
int idx = name.indexOf('.');
String childname = idx > 0 ? name.substring(0, idx) : name;
SubsetTag child = children.get(childname.replaceAll(" ", "").toLowerCase());
SubsetTag child = children.get(childname.replaceAll("\\s+", "").toLowerCase());
if (child == null) return null;

return idx > 0 ? child.getTag(name.substring(idx + 1)) : child;
Expand All @@ -192,18 +192,18 @@ private void addTag(SubsetTag tag) {
int idx = name.indexOf('.');

if (idx < 0) { // add or replace tag
SubsetTag prev = children.put(name.replaceAll(" ", "").toLowerCase(), tag);
SubsetTag prev = children.put(name.replaceAll("\\s+", "").toLowerCase(), tag);
if (prev != null) { // replaced, load children
tag.children = prev.children;
tag.sorted = prev.sorted;
}
recacheChildren();
} else {
String childname = name.substring(0, idx);
SubsetTag child = children.get(childname.replaceAll(" ", "").toLowerCase());
SubsetTag child = children.get(childname.replaceAll("\\s+", "").toLowerCase());
if (child == null) {
children.put(
childname.replaceAll(" ", "").toLowerCase(),
childname.replaceAll("\\s+", "").toLowerCase(),
child = new SubsetTag(fullname == null ? childname : fullname + '.' + childname));
}
recacheChildren();
Expand Down

0 comments on commit 4ad89e8

Please sign in to comment.