From 844fd5b8d9bca3e29979cb99aa716e3d1db1fb89 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 2 Oct 2022 17:24:44 +0800 Subject: [PATCH] Repo // Let L-Shift toggle become effective immediately. --- Source/Modules/PrefMgr_Core.swift | 6 +++++- Source/Modules/SessionCtl_Core.swift | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Modules/PrefMgr_Core.swift b/Source/Modules/PrefMgr_Core.swift index 00fd83a9..5f258811 100644 --- a/Source/Modules/PrefMgr_Core.swift +++ b/Source/Modules/PrefMgr_Core.swift @@ -103,7 +103,11 @@ public class PrefMgr: PrefMgrProtocol { public var upperCaseLetterKeyBehavior: Int @AppProperty(key: UserDef.kTogglingAlphanumericalModeWithLShift.rawValue, defaultValue: true) - public var togglingAlphanumericalModeWithLShift: Bool + public var togglingAlphanumericalModeWithLShift: Bool { + didSet { + SessionCtl.theShiftKeyDetector.alsoToggleWithLShift = togglingAlphanumericalModeWithLShift + } + } @AppProperty(key: UserDef.kDisableShiftTogglingAlphanumericalMode.rawValue, defaultValue: false) public var disableShiftTogglingAlphanumericalMode: Bool diff --git a/Source/Modules/SessionCtl_Core.swift b/Source/Modules/SessionCtl_Core.swift index 82c56c17..48af84e2 100644 --- a/Source/Modules/SessionCtl_Core.swift +++ b/Source/Modules/SessionCtl_Core.swift @@ -173,6 +173,7 @@ extension SessionCtl { keyHandler.clear() // 這句不要砍,因為後面 handle State.Empty() 不一定執行。 keyHandler.ensureKeyboardParser() + Self.theShiftKeyDetector.alsoToggleWithLShift = PrefMgr.shared.togglingAlphanumericalModeWithLShift if isASCIIMode, !isCapsLocked, PrefMgr.shared.disableShiftTogglingAlphanumericalMode { isASCIIMode = false } if isCapsLocked { isASCIIMode = isCapsLocked } // 同步 Caps Lock 狀態。