From 051203b0814bc498e4e648cc7080b3d5eb203548 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 22 Feb 2022 22:06:08 +0800 Subject: [PATCH] KeyHandler // Cancel the CandidateState when Builder is Empty. --- Source/Modules/ControllerModules/KeyHandler.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Modules/ControllerModules/KeyHandler.mm b/Source/Modules/ControllerModules/KeyHandler.mm index 44cd1383..3007bd69 100644 --- a/Source/Modules/ControllerModules/KeyHandler.mm +++ b/Source/Modules/ControllerModules/KeyHandler.mm @@ -1000,6 +1000,12 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; [self clear]; InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init]; stateCallback(empty); + } else if ([self isBuilderEmpty]) { + // 如果此時發現當前組字緩衝區為真空的情況的話,就將當前的組字緩衝區析構處理、強制重設輸入狀態。 + // 不然的話,一個本不該出現的真空組字緩衝區會使前後方向鍵與 BackSpace 鍵失靈。 + [self clear]; + InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init]; + stateCallback(empty); } else { InputStateInputting *inputting = (InputStateInputting *)[self buildInputtingState]; stateCallback(inputting);