chatcommands: consume "clear single word" keypress

Prevents a binding of "Ctrl+Backspace" from triggering the "clear single word" and also removing the remaining trailing space.

Closes #14941
This commit is contained in:
LlemonDuck
2022-05-11 23:18:26 -04:00
committed by Jordan
parent 4f4c502b17
commit c22ae453c2

View File

@@ -65,6 +65,9 @@ public class ChatKeyboardListener implements KeyListener
if (input != null) if (input != null)
{ {
// prevent the keypress from also modifying the chatbox as we alter the text
e.consume();
// remove trailing space // remove trailing space
while (input.endsWith(" ")) while (input.endsWith(" "))
{ {
@@ -80,6 +83,7 @@ public class ChatKeyboardListener implements KeyListener
} }
else if (chatCommandsConfig.clearChatBox().matches(e)) else if (chatCommandsConfig.clearChatBox().matches(e))
{ {
e.consume();
int inputTye = client.getVar(VarClientInt.INPUT_TYPE); int inputTye = client.getVar(VarClientInt.INPUT_TYPE);
clientThread.invoke(() -> applyText(inputTye, "")); clientThread.invoke(() -> applyText(inputTye, ""));
} }