SessionCtl // Tweak resetInputHandler().

This commit is contained in:
ShikiSuen 2022-11-25 11:09:55 +08:00
parent 8043bd683c
commit 850a48b883
1 changed files with 7 additions and 5 deletions

View File

@ -184,14 +184,16 @@ extension SessionCtl {
/// 調 /// 調
public func resetInputHandler(forceComposerCleanup forceCleanup: Bool = false) { public func resetInputHandler(forceComposerCleanup forceCleanup: Bool = false) {
var textToCommit = ""
// //
if state.type == .ofInputting, PrefMgr.shared.trimUnfinishedReadingsOnCommit || forceCleanup { let sansReading: Bool =
inputHandler.clearComposerAndCalligrapher() (state.type == .ofInputting) && (PrefMgr.shared.trimUnfinishedReadingsOnCommit || forceCleanup)
} textToCommit = inputHandler.generateStateOfInputting(sansReading: sansReading).displayedText
// IMKTextInput // IMKTextInput
// Shift+Delete // Shift+Delete
switchState(IMEState.ofCommitting(textToCommit: inputHandler.generateStateOfInputting().displayedText)) if !inputHandler.isCompositorEmpty {
// switchState(isSecureMode ? IMEState.ofAbortion() : IMEState.ofEmpty()) switchState(IMEState.ofCommitting(textToCommit: textToCommit))
}
} }
} }