diff options
author | xander <xander@isxander.dev> | 2022-09-23 14:12:38 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-23 14:12:38 +0100 |
commit | 5e288e914f015adda495b3cd8570943b399172ff (patch) | |
tree | d91b309e0fbeb6c5b9d420ac818637ba3170ec73 /src/main/java/dev/isxander/yacl/gui/YACLScreen.java | |
parent | f77914f74903164c34bf44bfbe4c298da87e1e32 (diff) | |
download | YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.tar.gz YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.tar.bz2 YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.zip |
1.4.4
Fix search not behaving properly with default collapsed option groups
Minor refactors
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/YACLScreen.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/YACLScreen.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java index 63cb2f6..70c61c1 100644 --- a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java +++ b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java @@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class YACLScreen extends Screen { public final YetAnotherConfigLib config; - public int currentCategoryIdx; + private int currentCategoryIdx; private final Screen parent; @@ -139,6 +139,9 @@ public class YACLScreen extends Screen { } public void changeCategory(int idx) { + if (idx == currentCategoryIdx) + return; + if (idx != -1 && config.categories().get(idx) instanceof PlaceholderCategory placeholderCategory) { client.setScreen(placeholderCategory.screen().apply(client, this)); } else { @@ -147,6 +150,10 @@ public class YACLScreen extends Screen { } } + public int getCurrentCategoryIdx() { + return currentCategoryIdx; + } + private void updateActionAvailability() { boolean pendingChanges = pendingChanges(); @@ -160,12 +167,6 @@ public class YACLScreen extends Screen { @Override public void tick() { searchFieldWidget.tick(); - if (!searchFieldWidget.getText().isEmpty() && currentCategoryIdx != -1) { - changeCategory(-1); - } - if (searchFieldWidget.getText().isEmpty() && currentCategoryIdx == -1) { - changeCategory(0); - } updateActionAvailability(); |