From 6b045fbb9677f2332a99d61515f2dbcf18afe68d Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 29 Jul 2018 15:40:19 -0600 Subject: [PATCH] runelite-client: Always call done after changed in ChatboxInptutManager Also changed doesn't need to be called twice when escaping from the menu --- .../client/game/ChatboxInputManager.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java b/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java index ce8dcc750b..eabf6039a9 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ChatboxInputManager.java @@ -116,30 +116,23 @@ public class ChatboxInputManager int stringStackSize = client.getStringStackSize(); int typedKey = client.getIntStack()[--intStackSize]; String str = client.getStringStack()[--stringStackSize]; - int retval = 0; + boolean isDone = false; switch (typedKey) { case 27: // Escape str = ""; - if (changed != null) - { - changed.accept(str); - } // fallthrough case '\n': - if (done != null) - { - done.accept(str); - } this.open = false; - retval = 1; + isDone = true; break; case '\b': if (str.length() > 0) { str = str.substring(0, str.length() - 1); } + break; default: // If we wanted to do numbers only, we could add a limit here if (typedKey >= 32 && (str.length() < characterLimit)) @@ -153,8 +146,13 @@ public class ChatboxInputManager changed.accept(str); } + if (isDone && done != null) + { + done.accept(str); + } + client.getStringStack()[stringStackSize++] = str; - client.getIntStack()[intStackSize++] = retval; + client.getIntStack()[intStackSize++] = isDone ? 1 : 0; client.setIntStackSize(intStackSize); client.setStringStackSize(stringStackSize); }