diff options
author | Lulonaut <67191924+Lulonaut@users.noreply.github.com> | 2022-05-24 10:47:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-24 08:47:44 +0000 |
commit | 07444d592fdb41371734056798e3a44e25b8a3e3 (patch) | |
tree | f813befe872dc00a00cea84dc5fea5507f20191c /src/main/java | |
parent | 6a997f1670df7f7112e7616c0f02fcc490289946 (diff) | |
download | NotEnoughUpdates-07444d592fdb41371734056798e3a44e25b8a3e3.tar.gz NotEnoughUpdates-07444d592fdb41371734056798e3a44e25b8a3e3.tar.bz2 NotEnoughUpdates-07444d592fdb41371734056798e3a44e25b8a3e3.zip |
Fix ctrl+v pasting twice (#148)
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java index 95dbeccd..aa88cb77 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java @@ -212,6 +212,7 @@ public class GuiElementTextField extends GuiElement { if (focus) { //allows for pasting formatted text that includes "§" if (GuiScreen.isKeyComboCtrlV(keyCode)) { + textField.setEnabled(false); //The cursor position gets set to the end when using setText int oldCursorPosition = textField.getCursorPosition(); @@ -222,6 +223,8 @@ public class GuiElementTextField extends GuiElement { //writeText removes unwanted chars from the String which includes "§" textField.setText(stringBuilder.toString()); textField.setCursorPosition(oldCursorPosition + clipboardContent.length()); + } else { + textField.setEnabled(true); } if ((options & MULTILINE) != 0) { //Carriage return |