From 58d84b4c929cf0f1ae53a291d080d1dbeef9dc8e Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 28 Feb 2022 20:33:55 +0800 Subject: [PATCH] KeyHandler // Allow users to define SPACE key behavior in Candidate Window. --- Source/Modules/ControllerModules/KeyHandler.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index a5d6effe..7433e943 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -1046,7 +1046,21 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; return YES; } - if ([input isSpace] || [input isPageDown] || input.emacsKey == vChewingEmacsKeyNextPage) { + if ([input isSpace]) { + BOOL updated = + Preferences.specifySpaceKeyBehavior? + ([input isShiftHold] ? [gCurrentCandidateController highlightNextCandidate] : [gCurrentCandidateController showNextPage]) + : + ([input isShiftHold] ? [gCurrentCandidateController showNextPage] : [gCurrentCandidateController highlightNextCandidate]) + ; + if (!updated) { + [IME prtDebugIntel:@"A11C781F"]; + errorCallback(); + } + return YES; + } + + if ([input isPageDown] || input.emacsKey == vChewingEmacsKeyNextPage) { BOOL updated = [gCurrentCandidateController showNextPage]; if (!updated) { [IME prtDebugIntel:@"9B691919"];