From dfcb99eebe316f51910e779aa77c039c258af0b1 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 19 Oct 2022 01:05:45 +0800 Subject: [PATCH] InputHandler // Force ASCII raw output in cassette mode. --- Source/Modules/InputHandler_HandleInput.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Modules/InputHandler_HandleInput.swift b/Source/Modules/InputHandler_HandleInput.swift index 79e25042..b7eef1d7 100644 --- a/Source/Modules/InputHandler_HandleInput.swift +++ b/Source/Modules/InputHandler_HandleInput.swift @@ -10,6 +10,7 @@ /// 按鍵調度模組要率先處理」的部分。據此判斷是否需要將按鍵處理委派給其它成員函式。 import CocoaExtension +import IMKUtils import LangModelAssembly import Shared @@ -275,6 +276,14 @@ extension InputHandler { return true } + // 將 Apple 動態鍵盤佈局的 RAW 輸出轉為 ABC 輸出。僅對磁帶模式啟用此步驟。 + if IMKHelper.isDynamicBasicKeyboardLayoutEnabled, let event = input as? NSEvent, + prefs.cassetteEnabled, let txtABC = event.inAppleABCStaticForm.characters, !txtABC.isEmpty + { + delegate.switchState(IMEState.ofCommitting(textToCommit: txtABC)) + return true + } + return false } }