mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
better handling of null keysymbol
This commit is contained in:
@@ -257,7 +257,7 @@ object IME {
|
||||
{ headkey, shifted, alted, lowLayerKeysym ->
|
||||
val a = jsval.invokeMember("accept", headkey, shifted, alted, lowLayerKeysym)
|
||||
// println(a.getArrayElement(0).asString().map { it.code.toString(16) })
|
||||
a.getArrayElement(0).asString().toCanditates() to a.getArrayElement(1).asString()
|
||||
a.getArrayElement(0).asString().toCanditates() to a.getArrayElement(1).let { if (it.isNull) "" else it.asString() }
|
||||
}, {
|
||||
jsval.invokeMember("backspace").asString().toCanditates()
|
||||
}, {
|
||||
|
||||
@@ -83,7 +83,7 @@ object InputStrober {
|
||||
|
||||
if (!keyChanged) {
|
||||
// println("KEY_DOWN '$keysym' ($headKeyCode) $repeatCount")
|
||||
App.inputStrobed(TerrarumKeyboardEvent(KEY_DOWN, keysym, headKeyCode, repeatCount, keybuf))
|
||||
App.inputStrobed(TerrarumKeyboardEvent(KEY_DOWN, keysym ?: "", headKeyCode, repeatCount, keybuf))
|
||||
}
|
||||
else if (newKeysym != null) {
|
||||
// println("KEY_DOWC '$newKeysym' ($headKeyCode) $repeatCount")
|
||||
@@ -159,7 +159,7 @@ object InputStrober {
|
||||
|
||||
data class TerrarumKeyboardEvent(
|
||||
val type: Int,
|
||||
val character: String?, // representative key symbol
|
||||
val character: String, // representative key symbol
|
||||
val headkey: Int, // representative keycode
|
||||
val repeatCount: Int,
|
||||
val keycodes: IntArray
|
||||
|
||||
@@ -453,7 +453,7 @@ open private class UIItemInputKeycap(
|
||||
else if (parent.shiftin && keysym0[1]?.isNotEmpty() == true) keysym0[1]
|
||||
else keysym0[0]) ?: keysymLow
|
||||
|
||||
if (keysym.isEmpty()) {
|
||||
if (keysym.isEmpty() || keysym.length == 8 && keysym.contains("null")) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user