From 15d8b90c05c04dd1f198edf4b43f4d50603b2b6b Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 16 Feb 2022 00:45:18 +0800 Subject: [PATCH] ctlInputMethod // Fix an issue that CHT mode can't type. --- Source/Modules/IMEModules/ctlInputMethod.swift | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift index 4335b49f..ed0a0b0f 100644 --- a/Source/Modules/IMEModules/ctlInputMethod.swift +++ b/Source/Modules/IMEModules/ctlInputMethod.swift @@ -331,23 +331,21 @@ extension ctlInputMethod { private func commit(text: String, client: Any!) { func kanjiConversionIfRequired(_ text: String) -> String { - var result : String = "" if keyHandler.inputMode == InputMode.imeModeCHT { if !Preferences.chineseConversionEnabled && Preferences.shiftJISShinjitaiOutputEnabled { - result = vChewingKanjiConverter.cnvTradToJIS(text) + return vChewingKanjiConverter.cnvTradToJIS(text) } if Preferences.chineseConversionEnabled && !Preferences.shiftJISShinjitaiOutputEnabled { - result = vChewingKanjiConverter.cnvTradToKangXi(text) + return vChewingKanjiConverter.cnvTradToKangXi(text) } // 本來這兩個開關不該同時開啟的,但萬一被開啟了的話就這樣處理: if Preferences.chineseConversionEnabled && Preferences.shiftJISShinjitaiOutputEnabled { - result = vChewingKanjiConverter.cnvTradToJIS(text) + return vChewingKanjiConverter.cnvTradToJIS(text) } + // if (!Preferences.chineseConversionEnabled && !Preferences.shiftJISShinjitaiOutputEnabled) || (keyHandler.inputMode != InputMode.imeModeCHT); + return text } - // if (!Preferences.chineseConversionEnabled && !Preferences.shiftJISShinjitaiOutputEnabled) || (keyHandler.inputMode != InputMode.imeModeCHT); - result = text - - return result + return text } let buffer = kanjiConversionIfRequired(text)