text input: fixed a bug where pasting would advance the internal cursor but the actual text wouldn't go in

This commit is contained in:
minjaesong
2021-12-09 19:08:20 +09:00
parent 44d6d84bbd
commit b8361a9514

View File

@@ -280,6 +280,11 @@ class UIItemTextLineInput(
tryCursorBack()
}
}
else if (keycodes.containsSome(Input.Keys.ENTER, Input.Keys.NUMPAD_ENTER)) {
endComposing()
println("END COMPOSING!!")
}
// accept:
// - literal "<"
// - keysymbol that does not start with "<" (not always has length of 1 because UTF-16)
@@ -321,13 +326,13 @@ class UIItemTextLineInput(
moveCursorToEnd(codepoints.size)
}
}
else if (keycodes.containsSome(Input.Keys.ENTER, Input.Keys.NUMPAD_ENTER)) {
endComposing()
}
// don't put innards of tryCursorBack/Forward here -- you absolutely don't want that behaviour
}
}
catch (e: IndexOutOfBoundsException) {
e.printStackTrace()
}
catch (e: NullPointerException) {
e.printStackTrace()
}
@@ -341,6 +346,7 @@ class UIItemTextLineInput(
}
fboUpdateLatch = true
}
override fun update(delta: Float) {
@@ -418,6 +424,7 @@ class UIItemTextLineInput(
actuallyInserted.removeAt(0)
textbuf.addAll(actuallyInserted)
moveCursorToEnd(actuallyInserted.size)
tryCursorBack()