runelite-client: Always call done after changed in ChatboxInptutManager
Also changed doesn't need to be called twice when escaping from the menu
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user