From 6c2a51651fedf49af24bd9868b5fd6545d7dd42e Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 1 Sep 2022 22:26:38 +0800 Subject: [PATCH] Repo // Apply shouldAlwaysUseShiftKeyAccommodation --- .../ControllerModules/ctlInputMethod_Common.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Common.swift b/Source/Modules/ControllerModules/ctlInputMethod_Common.swift index c8ce5ae5..76e6b900 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Common.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Common.swift @@ -17,9 +17,15 @@ extension ctlInputMethod { /// - Returns: 回「`true`」以將該案件已攔截處理的訊息傳遞給 IMK;回「`false`」則放行、不作處理。 func commonEventHandler(_ event: NSEvent) -> Bool { // 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。 - let shouldUseHandle = - (IME.arrClientShiftHandlingExceptionList.contains(clientBundleIdentifier) - || mgrPrefs.shouldAlwaysUseShiftKeyAccommodation) + let shouldUseHandle: Bool = { + switch mgrPrefs.shiftKeyAccommodationBehavior { + case 0: return false + case 1: return IME.arrClientShiftHandlingExceptionList.contains(clientBundleIdentifier) + case 2: return true + default: return false + } + }() + if #available(macOS 10.15, *) { if ShiftKeyUpChecker.check(event), !mgrPrefs.disableShiftTogglingAlphanumericalMode { if !shouldUseHandle || (!rencentKeyHandledByKeyHandler && shouldUseHandle) {