more endcomposing conditions

This commit is contained in:
minjaesong
2021-10-23 16:05:13 +09:00
parent c987961e07
commit 129061d743

View File

@@ -175,7 +175,8 @@ class UIItemTextLineInput(
copyToClipboard() copyToClipboard()
} }
else if (keycodes.contains(Input.Keys.BACKSPACE)) { else if (keycodes.contains(Input.Keys.BACKSPACE)) {
if (ime != null && composingView.size > 0) { if (ime != null && ime.composing()) {
// TODO ime.backspace() instead of resetIME()
resetIME() resetIME()
} }
else if (cursorX <= 0) { else if (cursorX <= 0) {
@@ -274,6 +275,7 @@ class UIItemTextLineInput(
mouseLatched = true mouseLatched = true
} }
else if (mouseDown && !mouseLatched && (enablePasteButton && enableIMEButton && mouseUpOnButton2 || enablePasteButton && !enableIMEButton && mouseUpOnButton2)) { else if (mouseDown && !mouseLatched && (enablePasteButton && enableIMEButton && mouseUpOnButton2 || enablePasteButton && !enableIMEButton && mouseUpOnButton2)) {
endComposing()
paste(Clipboard.fetch().substringBefore('\n').substringBefore('\t').toCodePoints()) paste(Clipboard.fetch().substringBefore('\n').substringBefore('\t').toCodePoints())
mouseLatched = true mouseLatched = true
} }
@@ -289,18 +291,19 @@ class UIItemTextLineInput(
paste(s.toCodePoints()) paste(s.toCodePoints())
} }
fboUpdateLatch = true fboUpdateLatch = true
resetIME() composingView = CodepointSequence()
// resetIME() // not needed; IME will reset itself
} }
private fun toggleIME() { private fun toggleIME() {
endComposing()
if (App.getConfigString("inputmethod") == "none") { if (App.getConfigString("inputmethod") == "none") {
imeOn = false imeOn = false
return return
} }
imeOn = !imeOn imeOn = !imeOn
resetIME()
} }
private fun resetIME() { private fun resetIME() {
@@ -309,8 +312,6 @@ class UIItemTextLineInput(
} }
private fun paste(codepoints: List<Int>) { private fun paste(codepoints: List<Int>) {
resetIME()
val actuallyInserted = arrayListOf(0) val actuallyInserted = arrayListOf(0)
for (c in codepoints) { for (c in codepoints) {