From 49390b1076eae3779211be5e434a04fb9fda5288 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 18 Apr 2022 16:48:38 +0800 Subject: [PATCH] IME // Allow getInputMode to return a reversed mode. --- Source/Modules/IMEModules/IME.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Modules/IMEModules/IME.swift b/Source/Modules/IMEModules/IME.swift index 6abcd603..91f9604a 100644 --- a/Source/Modules/IMEModules/IME.swift +++ b/Source/Modules/IMEModules/IME.swift @@ -35,8 +35,13 @@ public class IME: NSObject { // MARK: - 自 ctlInputMethod 讀取當前輸入法的簡繁體模式 - static func getInputMode() -> InputMode { - ctlInputMethod.currentKeyHandler.inputMode + static func getInputMode(isReversed: Bool = false) -> InputMode { + if isReversed { + return (ctlInputMethod.currentKeyHandler.inputMode == InputMode.imeModeCHT) + ? InputMode.imeModeCHS : InputMode.imeModeCHT + } else { + return ctlInputMethod.currentKeyHandler.inputMode + } } // MARK: - Print debug information to the console.