From 4c0445115b49c101424a582573b030ccd93332b9 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 13 Feb 2023 18:50:47 +0800 Subject: [PATCH] =?UTF-8?q?InputHandler=20//=20Let=20g=E2=80=A6S=E2=80=A6O?= =?UTF-8?q?fInputting()=20returns=20.ofAbortion()=20if=20needed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Modules/InputHandler_Core.swift | 3 +++ Source/Modules/InputHandler_HandleStates.swift | 1 + 2 files changed, 4 insertions(+) diff --git a/Source/Modules/InputHandler_Core.swift b/Source/Modules/InputHandler_Core.swift index 72ee8bd5..afbe8b6e 100644 --- a/Source/Modules/InputHandler_Core.swift +++ b/Source/Modules/InputHandler_Core.swift @@ -111,6 +111,9 @@ public class InputHandler: InputHandlerProtocol { isCodePointInputMode = false } + /// 警告:該參數僅代指組音區/組筆區域與組字區在目前狀態下被視為「空」。 + var isConsideredEmptyForNow: Bool { compositor.isEmpty && isComposerOrCalligrapherEmpty } + // MARK: - Hanin Keyboard Symbol Mode. var isHaninKeyboardSymbolMode = false diff --git a/Source/Modules/InputHandler_HandleStates.swift b/Source/Modules/InputHandler_HandleStates.swift index d674e884..a6375049 100644 --- a/Source/Modules/InputHandler_HandleStates.swift +++ b/Source/Modules/InputHandler_HandleStates.swift @@ -19,6 +19,7 @@ extension InputHandler { /// 生成「正在輸入」狀態。相關的內容會被拿給狀態機械用來處理在電腦螢幕上顯示的內容。 public func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol { + if isConsideredEmptyForNow { return IMEState.ofAbortion() } let cpInput = isCodePointInputMode && !sansReading /// 「更新內文組字區 (Update the composing buffer)」是指要求客體軟體將組字緩衝區的內容 /// 換成由此處重新生成的原始資料在 IMEStateData 當中生成的 NSAttributeString。