diff --git a/Source/Modules/InputHandler_Core.swift b/Source/Modules/InputHandler_Core.swift index 84205ed9..38d97d40 100644 --- a/Source/Modules/InputHandler_Core.swift +++ b/Source/Modules/InputHandler_Core.swift @@ -28,11 +28,17 @@ public protocol InputHandlerProtocol { func clearComposerAndCalligrapher() func ensureKeyboardParser() func handleEvent(_ event: NSEvent) -> Bool - func generateStateOfInputting() -> IMEStateProtocol + func generateStateOfInputting(sansReading: Bool) -> IMEStateProtocol func generateStateOfAssociates(withPair pair: Megrez.Compositor.KeyValuePaired) -> IMEStateProtocol func consolidateNode(candidate: (String, String), respectCursorPushing: Bool, preConsolidate: Bool) } +extension InputHandlerProtocol { + func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol { + generateStateOfInputting(sansReading: sansReading) + } +} + // MARK: - 委任協定 (Delegate). /// InputHandler 委任協定 diff --git a/Source/Modules/InputHandler_States.swift b/Source/Modules/InputHandler_States.swift index d76c80d5..72e0ac06 100644 --- a/Source/Modules/InputHandler_States.swift +++ b/Source/Modules/InputHandler_States.swift @@ -18,12 +18,12 @@ extension InputHandler { // MARK: - 構築狀態(State Building) /// 生成「正在輸入」狀態。相關的內容會被拿給狀態機械用來處理在電腦螢幕上顯示的內容。 - public func generateStateOfInputting() -> IMEStateProtocol { + public func generateStateOfInputting(sansReading: Bool = false) -> IMEStateProtocol { /// 「更新內文組字區 (Update the composing buffer)」是指要求客體軟體將組字緩衝區的內容 /// 換成由此處重新生成的原始資料在 IMEStateData 當中生成的 NSAttributeString。 var displayTextSegments: [String] = compositor.walkedNodes.values var cursor = convertCursorForDisplay(compositor.cursor) - let reading: String = readingForDisplay // 先提出來,減輕運算負擔。 + let reading: String = sansReading ? "" : readingForDisplay // 先提出來,減輕運算負擔。 if !reading.isEmpty { var newDisplayTextSegments = [String]() var temporaryNode = ""