From 3851f91d6cd97712847b210c080c22148cb0f69c Mon Sep 17 00:00:00 2001 From: zonble Date: Mon, 31 Jan 2022 04:47:45 +0800 Subject: [PATCH] Fixes the bug that Shift+Space did not commit current composing buffer. --- Source/KeyHandler.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/KeyHandler.mm b/Source/KeyHandler.mm index 38f02774..6a1fcc6f 100644 --- a/Source/KeyHandler.mm +++ b/Source/KeyHandler.mm @@ -372,6 +372,13 @@ static NSString *const kGraphVizOutputfile = @"/tmp/McBopomofo-visualization.dot // if the spacebar is NOT set to be a selection key if ([input isShiftHold] || !Preferences.chooseCandidateUsingSpace) { 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]; InputStateCommitting *committing = [[InputStateCommitting alloc] initWithPoppedText:@" "]; stateCallback(committing);