Fixes the bug that Shift+Space did not commit current composing buffer.

This commit is contained in:
zonble 2022-01-31 04:47:45 +08:00
parent 3099798195
commit 3851f91d6c
1 changed files with 7 additions and 0 deletions

View File

@ -372,6 +372,13 @@ static NSString *const kGraphVizOutputfile = @"/tmp/McBopomofo-visualization.dot
// if the spacebar is NOT set to be a selection key // if the spacebar is NOT set to be a selection key
if ([input isShiftHold] || !Preferences.chooseCandidateUsingSpace) { if ([input isShiftHold] || !Preferences.chooseCandidateUsingSpace) {
if (_builder->cursorIndex() >= _builder->length()) { if (_builder->cursorIndex() >= _builder->length()) {
if ([state isKindOfClass:[InputStateNotEmpty class]]) {
NSString *composingBuffer = [(InputStateNotEmpty *)state composingBuffer];
if ([composingBuffer length]) {
InputStateCommitting *committing = [[InputStateCommitting alloc] initWithPoppedText:composingBuffer];
stateCallback(committing);
}
}
[self clear]; [self clear];
InputStateCommitting *committing = [[InputStateCommitting alloc] initWithPoppedText:@" "]; InputStateCommitting *committing = [[InputStateCommitting alloc] initWithPoppedText:@" "];
stateCallback(committing); stateCallback(committing);