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.
This commit is contained in:
ShikiSuen 2022-03-05 14:07:27 +08:00
parent 4458336440
commit 7e16a05d54
1 changed files with 3 additions and 5 deletions

View File

@ -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];