diff options
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java index 12c6ae6..97023aa 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java @@ -390,7 +390,7 @@ public class WTextField extends WWidget { b = a; a = tmp; } - invertedRect(textX+a-1, textY-1, b-a, 12); + invertedRect(textX+a-1, textY-1, Math.min(b-a, width - OFFSET_X_TEXT), 12); // int int_10 = int_6 + MinecraftClient.getInstance().textRenderer.getStringWidth(trimText.substring(0, adjustedCursor)); // var10002 = int_7 - 1; // var10003 = int_10 - 1; @@ -557,7 +557,7 @@ public class WTextField extends WWidget { @Override public void onKeyPressed(int ch, int key, int modifiers) { if (!this.editable) return; - + if (Screen.isCopy(ch)) { String selection = getSelection(); if (selection!=null) { @@ -594,6 +594,10 @@ public class WTextField extends WWidget { } } return; + } else if (Screen.isSelectAll(ch)) { + select = 0; + cursor = text.length(); + return; } //System.out.println("Ch: "+ch+", Key: "+key+", Mod: "+modifiers); |