From 764ffb86680f2a32d3bbdafcce204f20ff3c03a4 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 25 Jul 2022 17:51:56 +0800 Subject: [PATCH] KeyHandler // Allow typing FW space when state.Empty(). --- .../ControllerModules/KeyHandler_HandleInput.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift index 8a475086..c801d32f 100644 --- a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift +++ b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift @@ -475,6 +475,17 @@ extension KeyHandler { } } + // MARK: 全形/半形空白 (Full-Width / Half-Width Space) + + /// 該功能僅可在當前組字區沒有任何內容的時候使用。 + if state is InputState.Empty { + if input.isSpace, !input.isOptionHold, !input.isFunctionKeyHold, !input.isControlHold, !input.isCommandHold { + stateCallback(InputState.Committing(textToCommit: input.isShiftHold ? " " : " ")) + } + stateCallback(InputState.Empty()) + return true + } + // MARK: - 終末處理 (Still Nothing) /// 對剩下的漏網之魚做攔截處理、直接將當前狀態繼續回呼給 ctlInputMethod。