From fef6eb5f76e42b0ad5924b455e4c409607310974 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 8 Feb 2023 22:10:53 +0800 Subject: [PATCH] InputHandler // Remove unnecessary empty state switches. --- Source/Modules/InputHandler_HandleComposition.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Modules/InputHandler_HandleComposition.swift b/Source/Modules/InputHandler_HandleComposition.swift index e41eada6..8f645ed7 100644 --- a/Source/Modules/InputHandler_HandleComposition.swift +++ b/Source/Modules/InputHandler_HandleComposition.swift @@ -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) }