[fix] Command history

This commit is contained in:
Xiaro 2020-12-31 19:00:40 -05:00
parent 0d247244bf
commit d895459def
No known key found for this signature in database
GPG Key ID: 996D265D6E155377
1 changed files with 7 additions and 8 deletions

View File

@ -15,16 +15,16 @@ import org.kamiblue.command.AbstractArg
import org.kamiblue.command.AutoComplete import org.kamiblue.command.AutoComplete
import org.kamiblue.commons.extension.stream import org.kamiblue.commons.extension.stream
import org.lwjgl.input.Keyboard import org.lwjgl.input.Keyboard
import java.util.*
import kotlin.math.min import kotlin.math.min
class KamiGuiChat( class KamiGuiChat(
startStringIn: String, startStringIn: String,
historyBufferIn: String? = null, private val historyBufferIn: String? = null,
sentHistoryCursorIn: Int? = null private val sentHistoryCursorIn: Int? = null
) : GuiChat(startStringIn) { ) : GuiChat(startStringIn) {
init { override fun initGui() {
super.initGui()
historyBufferIn?.let { historyBuffer = it } historyBufferIn?.let { historyBuffer = it }
sentHistoryCursorIn?.let { sentHistoryCursor = it } sentHistoryCursorIn?.let { sentHistoryCursor = it }
} }
@ -79,11 +79,10 @@ class KamiGuiChat(
} }
private fun displayNormalChatGUI() { private fun displayNormalChatGUI() {
GuiChat(inputField.text).apply { GuiChat(inputField.text).also {
historyBuffer = this@KamiGuiChat.historyBuffer
sentHistoryCursor = this@KamiGuiChat.sentHistoryCursor
}.also {
mc.displayGuiScreen(it) mc.displayGuiScreen(it)
it.historyBuffer = this.historyBuffer
it.sentHistoryCursor = this.sentHistoryCursor
} }
} }