ctlIME // Clear composer when necessary.

This commit is contained in:
ShikiSuen 2022-08-29 18:27:10 +08:00
parent eba750048f
commit d36d0b7aa1
1 changed files with 15 additions and 1 deletions

View File

@ -60,6 +60,11 @@ class ctlInputMethod: IMKInputController {
/// 調 /// 調
func resetKeyHandler() { func resetKeyHandler() {
//
if state is InputState.Inputting, mgrPrefs.trimUnfinishedReadingsOnCommit {
keyHandler.composer.clear()
handle(state: keyHandler.buildInputtingState)
}
if let state = state as? InputState.NotEmpty { if let state = state as? InputState.NotEmpty {
/// 調 /// 調
handle(state: InputState.Committing(textToCommit: state.composingBufferConverted)) handle(state: InputState.Committing(textToCommit: state.composingBufferConverted))
@ -128,7 +133,7 @@ class ctlInputMethod: IMKInputController {
/// - Parameter sender: 使 /// - Parameter sender: 使
override func deactivateServer(_ sender: Any!) { override func deactivateServer(_ sender: Any!) {
_ = sender // _ = sender //
handle(state: InputState.Empty()) resetKeyHandler() // Empty
handle(state: InputState.Deactivated()) handle(state: InputState.Deactivated())
} }
@ -267,6 +272,7 @@ class ctlInputMethod: IMKInputController {
override func commitComposition(_ sender: Any!) { override func commitComposition(_ sender: Any!) {
_ = sender // _ = sender //
resetKeyHandler() resetKeyHandler()
// super.commitComposition(sender) //
} }
/// ///
@ -278,6 +284,14 @@ class ctlInputMethod: IMKInputController {
return state.committingBufferConverted return state.committingBufferConverted
} }
///
/// IMK Bug
override func inputControllerWillClose() {
//
resetKeyHandler()
super.inputControllerWillClose()
}
// MARK: - IMKCandidates // MARK: - IMKCandidates
/// IMK /// IMK