From e05278c53eb54892cc15e08cf33d4dcfcf3c35ae Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 5 Mar 2022 14:07:27 +0800 Subject: [PATCH] KeyHandler // Enable bpmf commit with Ctrl+CMD+Enter. - In UserPhraseEditor the hotkey is Ctrl+Enter, committing bpmf readings with separator "-". - In other apps the hotkey is Ctrl+CMD+Enter, committing bpmf readings with an ASCII space as the separator. --- Source/Modules/ControllerModules/KeyHandler.mm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index 3cb060d6..869d5560 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -524,7 +524,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; // MARK: Enter if ([input isEnter]) { if ([input isControlHold]) { - if (ctlInputMethod.areWeUsingOurOwnPhraseEditor) { + if (ctlInputMethod.areWeUsingOurOwnPhraseEditor || [input isCommandHold]) { return [self _handleCtrlEnterWithState:state stateCallback:stateCallback errorCallback:errorCallback]; } } @@ -850,12 +850,10 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; - (BOOL)_handleCtrlEnterWithState:(InputState *)state stateCallback:(void (^)(InputState *))stateCallback errorCallback:(void (^)(void))errorCallback { - if (![state isKindOfClass:[InputStateInputting class]]) { - return NO; - } + if (![state isKindOfClass:[InputStateInputting class]]) return NO; NSArray *readings = [self _currentReadings]; - NSString *composingBuffer = [readings componentsJoinedByString:@"-"]; + NSString *composingBuffer = (ctlInputMethod.areWeUsingOurOwnPhraseEditor) ? [readings componentsJoinedByString:@"-"] : [readings componentsJoinedByString:@" "] ; [self clear];