InputHandler // Improve handling of invalid inputs.

This commit is contained in:
ShikiSuen 2023-01-30 10:34:55 +08:00
parent e334fc60ec
commit 35d3c344ec
2 changed files with 6 additions and 10 deletions

View File

@ -111,7 +111,8 @@ extension InputHandler {
}
//
if !compositor.insertKey(readingKey) {
// Megrez
if !input.isInvalid, !compositor.insertKey(readingKey) {
delegate.callError("3CF278C9: 得檢查對應的語言模組的 hasUnigramsFor() 是否有誤判之情形。")
return true
}
@ -253,7 +254,8 @@ extension InputHandler {
}
//
if !compositor.insertKey(calligrapher) {
// Megrez
if !input.isInvalid, !compositor.insertKey(calligrapher) {
delegate.callError("61F6B11F: 得檢查對應的語言模組的 hasUnigramsFor() 是否有誤判之情形。")
return true
}

View File

@ -31,14 +31,8 @@ extension InputHandler {
let inputText: String = input.text
var state: IMEStateProtocol { delegate.state } //
// Megrez
if input.isInvalid {
// .Empty(IgnoringPreviousState) .Deactivated
// .Abortion.Empty
if state.type == .ofEmpty || state.type == .ofDeactivated { return false }
delegate.callError("550BCF7B: InputHandler just refused an invalid input.")
return true
}
//
if input.isInvalid, state.type == .ofEmpty || state.type == .ofDeactivated { return false }
//
let isFunctionKey: Bool =