InputHandler // Tweak pipeline for NSEvents with empty texts.

This commit is contained in:
ShikiSuen 2023-06-04 18:14:52 +08:00
parent 53182e2690
commit bf8d9f30f0
2 changed files with 9 additions and 3 deletions

View File

@ -17,6 +17,8 @@ extension InputHandler {
/// - input:
/// - Returns: IMK
func handleComposition(input: InputSignalProtocol) -> Bool? {
//
guard !input.text.isEmpty, input.charCode.isPrintable else { return nil }
if isCodePointInputMode { return handleCodePointComposition(input: input) }
if prefs.cassetteEnabled { return handleCassetteComposition(input: input) }
return handlePhonabetComposition(input: input)

View File

@ -23,10 +23,8 @@ extension InputHandler {
/// - input:
/// - Returns: IMK
func handleInput(event input: InputSignalProtocol) -> Bool {
// inputTest
//
// delegate
guard !input.text.isEmpty, input.charCode.isPrintable, let delegate = delegate else { return false }
guard let delegate = delegate else { return false }
let inputText: String = input.text
var state: IMEStateProtocol { delegate.state } //
@ -83,6 +81,12 @@ extension InputHandler {
if [.ofCandidates, .ofSymbolTable].contains(state.type) { return handleCandidate(input: input) }
// MARK:
// inputTest
//
guard !input.text.isEmpty, input.charCode.isPrintable else { return false }
// MARK: (Handle Associated Phrases)
if state.type == .ofAssociates {