From e77f253ed60c72f791c16ec01979d0011fe9aba7 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 1 Feb 2022 14:09:33 +0800 Subject: [PATCH] Zonble: UPR265 to let Shift+Space commit current comp. buffer. --- Source/Engine/ControllerModules/KeyHandler.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Engine/ControllerModules/KeyHandler.mm b/Source/Engine/ControllerModules/KeyHandler.mm index 195afee6..236e869e 100644 --- a/Source/Engine/ControllerModules/KeyHandler.mm +++ b/Source/Engine/ControllerModules/KeyHandler.mm @@ -364,7 +364,14 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; // if the spacebar is NOT set to be a selection key if ([input isShiftHold] || !Preferences.chooseCandidateUsingSpace) { if (_builder->cursorIndex() >= _builder->length()) { - [self clear]; + 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); InputStateEmpty *empty = [[InputStateEmpty alloc] init];