KeyHandler // Cancel the CandidateState when Builder is Empty.

This commit is contained in:
ShikiSuen 2022-02-22 22:06:08 +08:00
parent 2169743b2e
commit 051203b081
1 changed files with 6 additions and 0 deletions

View File

@ -1000,6 +1000,12 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
[self clear]; [self clear];
InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init]; InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init];
stateCallback(empty); stateCallback(empty);
} else if ([self isBuilderEmpty]) {
// 如果此時發現當前組字緩衝區為真空的情況的話,就將當前的組字緩衝區析構處理、強制重設輸入狀態。
// 不然的話,一個本不該出現的真空組字緩衝區會使前後方向鍵與 BackSpace 鍵失靈。
[self clear];
InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init];
stateCallback(empty);
} else { } else {
InputStateInputting *inputting = (InputStateInputting *)[self buildInputtingState]; InputStateInputting *inputting = (InputStateInputting *)[self buildInputtingState];
stateCallback(inputting); stateCallback(inputting);