chat history: just push if not blank

This commit is contained in:
Moritz Zwerger 2023-10-22 20:55:27 +02:00
parent 15ba52642b
commit ba9dfa1688
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -174,7 +174,7 @@ class ChatElement(guiRenderer: GUIRenderer) : AbstractChatElement(guiRenderer),
val value = input.value val value = input.value
input.submit() input.submit()
input.value = "" input.value = ""
if (history.lastOrNull() != value) { if (history.lastOrNull() != value && value.isNotBlank()) {
// ToDo: Improve history // ToDo: Improve history
history += value history += value
} }
@ -202,6 +202,7 @@ class ChatElement(guiRenderer: GUIRenderer) : AbstractChatElement(guiRenderer),
historyIndex-- historyIndex--
input.value = history[historyIndex] input.value = history[historyIndex]
} }
KeyCodes.KEY_DOWN -> { KeyCodes.KEY_DOWN -> {
val size = history.size val size = history.size
historyIndex++ historyIndex++