aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/2.0.1.md3
-rw-r--r--src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java4
2 files changed, 6 insertions, 1 deletions
diff --git a/changelogs/2.0.1.md b/changelogs/2.0.1.md
new file mode 100644
index 0000000..ffc66af
--- /dev/null
+++ b/changelogs/2.0.1.md
@@ -0,0 +1,3 @@
+- Allow `StringControllerElement` to have unlimited text length
+- When pressing `Delete` in a text field whilst text is highlighted,
+ it will act like `Backspace` like it should.
diff --git a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java b/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java
index b2a324e..d2c752b 100644
--- a/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java
+++ b/src/client/java/dev/isxander/yacl/gui/controllers/string/StringControllerElement.java
@@ -257,7 +257,9 @@ public class StringControllerElement extends ControllerWidget<IStringController<
}
protected void doDelete() {
- if (caretPos < inputField.length()) {
+ if (selectionLength != 0) {
+ write("");
+ } else if (caretPos < inputField.length()) {
modifyInput(builder -> builder.deleteCharAt(caretPos));
}
}