@@ -64,6 +64,11 @@ class TextInputManager(
64
64
var needSendUpRimeKey: Boolean = false
65
65
var isComposable: Boolean = false
66
66
67
+ private var shouldUpdateRimeOption
68
+ get() = trime.shouldUpdateRimeOption
69
+ set(value) {
70
+ trime.shouldUpdateRimeOption = value
71
+ }
67
72
private val shouldResetAsciiMode get() = trime.shouldResetAsciiMode
68
73
69
74
// TODO: move things using this context to InputView scope.
@@ -231,8 +236,10 @@ class TextInputManager(
231
236
KeyboardSwitcher .switchKeyboard(keyboard)
232
237
trime.bindKeyboardToInputView()
233
238
} else if (option.startsWith(" _key_" ) && option.length > 5 && value) {
239
+ shouldUpdateRimeOption = false // 防止在 handleRimeNotification 中 setOption
234
240
val key = option.substring(5 )
235
241
onEvent(EventManager .getEvent(key))
242
+ shouldUpdateRimeOption = true
236
243
}
237
244
}
238
245
}
@@ -252,8 +259,11 @@ class TextInputManager(
252
259
" , Event.getRimeEvent=" + Event .getRimeEvent(keyEventCode, Rime .META_RELEASE_ON ),
253
260
)
254
261
if (needSendUpRimeKey) {
255
- Rime .setOption(" soft_cursors" , prefs.keyboard.softCursorEnabled)
256
- Rime .setOption(" _horizontal" , ThemeManager .activeTheme.generalStyle.horizontal)
262
+ if (shouldUpdateRimeOption) {
263
+ Rime .setOption(" soft_cursors" , prefs.keyboard.softCursorEnabled)
264
+ Rime .setOption(" _horizontal" , ThemeManager .activeTheme.generalStyle.horizontal)
265
+ shouldUpdateRimeOption = false
266
+ }
257
267
// todo 释放按键可能不对
258
268
val event = Event .getRimeEvent(keyEventCode, Rime .META_RELEASE_ON )
259
269
Rime .processKey(event[0 ], event[1 ])
0 commit comments