3set: delete by letter pieces when assemblying

This commit is contained in:
minjaesong
2021-10-23 16:46:58 +09:00
parent 129061d743
commit 38462e4506
4 changed files with 68 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ data class TerrarumInputMethod(
val name: String,
// (headkey, shiftin, altgrin)
val acceptChar: (Int, Boolean, Boolean) -> Pair<String, String>, // Pair<Display Char, Output Char if any>
val backspace: () -> String,
val endCompose: () -> String,
val reset: () -> Unit,
val composing: () -> Boolean
@@ -109,6 +110,8 @@ object IME {
return TerrarumInputMethod(name, { headkey, shifted, alted ->
val a = jsval.invokeMember("accept", headkey, shifted, alted)
a.getArrayElement(0).asString() to a.getArrayElement(1).asString()
}, {
jsval.invokeMember("backspace").asString()
}, {
jsval.invokeMember("end").asString()
}, {

View File

@@ -176,8 +176,7 @@ class UIItemTextLineInput(
}
else if (keycodes.contains(Input.Keys.BACKSPACE)) {
if (ime != null && ime.composing()) {
// TODO ime.backspace() instead of resetIME()
resetIME()
composingView = CodepointSequence(ime.backspace().toCodePoints())
}
else if (cursorX <= 0) {
cursorX = 0
@@ -185,6 +184,7 @@ class UIItemTextLineInput(
cursorDrawScroll = 0
}
else {
endComposing()
if (cursorX > 0) {
while (true) {
cursorX -= 1