From fde7a7a42a1051f0725d4e6d1413da29a51e9e8b Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 24 Jan 2023 17:47:34 +0800 Subject: [PATCH] SessionCtl // Remove rencentKeyHandledByInputHandlerEtc. --- Source/Modules/SessionCtl_Core.swift | 3 --- Source/Modules/SessionCtl_HandleEvent.swift | 13 +++---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Source/Modules/SessionCtl_Core.swift b/Source/Modules/SessionCtl_Core.swift index a66f935a..2870041e 100644 --- a/Source/Modules/SessionCtl_Core.swift +++ b/Source/Modules/SessionCtl_Core.swift @@ -90,9 +90,6 @@ public class SessionCtl: IMKInputController { public static var theShiftKeyDetector = ShiftKeyUpChecker( useLShift: PrefMgr.shared.togglingAlphanumericalModeWithLShift) - /// `handle(event:)` 會利用這個參數判定某次 Shift 按鍵是否用來切換中英文輸入。 - public var rencentKeyHandledByInputHandlerEtc = false - /// 記錄當前輸入環境是縱排輸入還是橫排輸入。 public static var isVerticalTyping: Bool = false public var isVerticalTyping: Bool = false { diff --git a/Source/Modules/SessionCtl_HandleEvent.swift b/Source/Modules/SessionCtl_HandleEvent.swift index 0332da8f..8bcecc5d 100644 --- a/Source/Modules/SessionCtl_HandleEvent.swift +++ b/Source/Modules/SessionCtl_HandleEvent.swift @@ -72,15 +72,9 @@ extension SessionCtl { // 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。 // 警告:這裡的 event 必須是原始 event 且不能被 var,否則會影響 Shift 中英模式判定。 - if #available(macOS 10.15, *) { - if Self.theShiftKeyDetector.check(event), !PrefMgr.shared.disableShiftTogglingAlphanumericalMode { - if !rencentKeyHandledByInputHandlerEtc { - toggleAlphanumericalMode() - } else { - rencentKeyHandledByInputHandlerEtc = false - } - return true - } + if Self.theShiftKeyDetector.check(event), !PrefMgr.shared.disableShiftTogglingAlphanumericalMode { + toggleAlphanumericalMode() + return true } // 用 JIS 鍵盤的英數切換鍵來切換中英文模式。 @@ -150,7 +144,6 @@ extension SessionCtl { /// 直接交給 commonEventHandler 來處理。 let result = inputHandler.handleEvent(eventToDeal) - rencentKeyHandledByInputHandlerEtc = result if !result { // 除非是 .ofMarking 狀態,否則讓某些不用去抓的按鍵起到「取消工具提示」的作用。 if [.ofEmpty].contains(state.type) { tooltipInstance.hide() }