InputHandler // Remove unnecessary empty state switches.

This commit is contained in:
ShikiSuen 2023-02-08 22:10:53 +08:00
parent ce0d6e1fe4
commit fef6eb5f76
1 changed files with 2 additions and 6 deletions

View File

@ -145,9 +145,7 @@ extension InputHandler {
let text: String = firstCandidate.1
delegate.switchState(IMEState.ofCommitting(textToCommit: text))
if !prefs.associatedPhrasesEnabled {
delegate.switchState(IMEState.ofEmpty())
} else {
if prefs.associatedPhrasesEnabled {
let associatedPhrases = generateStateOfAssociates(withPair: .init(keyArray: [reading], value: text))
delegate.switchState(associatedPhrases.candidates.isEmpty ? IMEState.ofEmpty() : associatedPhrases)
}
@ -288,9 +286,7 @@ extension InputHandler {
let text: String = firstCandidate.1
delegate.switchState(IMEState.ofCommitting(textToCommit: text))
if !prefs.associatedPhrasesEnabled {
delegate.switchState(IMEState.ofEmpty())
} else {
if prefs.associatedPhrasesEnabled {
let associatedPhrases = generateStateOfAssociates(withPair: .init(keyArray: [reading], value: text))
delegate.switchState(associatedPhrases.candidates.isEmpty ? IMEState.ofEmpty() : associatedPhrases)
}