Repo // Clear calligrapher together on resetInputHandler() (#210)

This commit is contained in:
ShikiSuen 2022-10-27 19:00:30 +08:00
parent 7c4f141286
commit ba3e1a99a5
3 changed files with 10 additions and 6 deletions

View File

@ -22,7 +22,9 @@ public protocol InputHandlerProtocol {
var currentUOM: vChewingLM.LMUserOverride { get set }
var delegate: InputHandlerDelegate? { get set }
var composer: Tekkon.Composer { get set }
var isComposerUsingPinyin: Bool { get }
func clear()
func clearComposerAndCalligrapher()
func ensureKeyboardParser()
func handleEvent(_ event: NSEvent) -> Bool
func generateStateOfInputting() -> IMEStateProtocol
@ -82,9 +84,8 @@ public class InputHandler: InputHandlerProtocol {
}
public func clear() {
composer.clear()
clearComposerAndCalligrapher()
compositor.clear()
calligrapher.removeAll()
}
// MARK: - Functions dealing with Megrez.
@ -367,8 +368,11 @@ public class InputHandler: InputHandlerProtocol {
composer.phonabetCombinationCorrectionEnabled = prefs.autoCorrectReadingCombination
}
func clearComposerAndCalligrapher() {
_ = prefs.cassetteEnabled ? calligrapher.removeAll() : composer.clear()
public var isComposerUsingPinyin: Bool { composer.parser.rawValue >= 100 }
public func clearComposerAndCalligrapher() {
calligrapher.removeAll()
composer.clear()
}
func letComposerAndCalligrapherDoBackSpace() {

View File

@ -169,7 +169,7 @@ extension SessionCtl {
public func resetInputHandler() {
//
if state.type == .ofInputting, PrefMgr.shared.trimUnfinishedReadingsOnCommit {
inputHandler.composer.clear()
inputHandler.clearComposerAndCalligrapher()
switchState(inputHandler.generateStateOfInputting())
}
// IMKTextInput

View File

@ -117,7 +117,7 @@ extension SessionCtl {
}
//
if inputHandler.composer.parser.rawValue < 100 || IMKHelper.isDynamicBasicKeyboardLayoutEnabled {
if !inputHandler.isComposerUsingPinyin || IMKHelper.isDynamicBasicKeyboardLayoutEnabled {
eventToDeal = eventToDeal.inAppleABCStaticForm
}