Skip to content

Commit f2d7792

Browse files
goofyzBambooin
authored andcommitted
fix: reset to original state when restarting input in the same view
Clear any composing input or view when input is restarted in the same text view, thus ensure a fresh input UI. Fixes #1134
1 parent 0bd141d commit f2d7792

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

app/src/main/java/com/osfans/trime/ime/core/Trime.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ private boolean performEnter(int keyCode) { // 回車
12461246
}
12471247

12481248
/** 模擬PC鍵盤中Esc鍵的功能:清除輸入的編碼和候選項 */
1249-
private void performEscape() {
1249+
public void performEscape() {
12501250
if (isComposing()) textInputManager.onKey(KeyEvent.KEYCODE_ESCAPE, 0);
12511251
}
12521252

app/src/main/java/com/osfans/trime/ime/text/TextInputManager.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ class TextInputManager private constructor() :
189189
) {
190190
super.onStartInputView(instance, restarting)
191191
Trime.getService().selectLiquidKeyboard(-1)
192+
if (restarting) {
193+
trime.performEscape()
194+
}
192195
isComposable = false
193196
var tempAsciiMode = if (shouldResetAsciiMode) false else null
194197
val keyboardType =

0 commit comments

Comments
 (0)