Fixes the behavior of the delete and backspace key.

This commit is contained in:
zonble 2022-01-28 16:59:28 +08:00
parent 9612aa6ba0
commit ee521b6ee2
1 changed files with 12 additions and 2 deletions

View File

@ -658,7 +658,12 @@ static NSString *const kGraphVizOutputfile = @"/tmp/McBopomofo-visualization.dot
}
InputStateInputting *inputting = [self _buildInputtingState];
stateCallback(inputting);
if (!inputting.composingBuffer.length) {
InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init];
stateCallback(empty);
} else {
stateCallback(inputting);
}
return YES;
}
@ -673,7 +678,12 @@ static NSString *const kGraphVizOutputfile = @"/tmp/McBopomofo-visualization.dot
_builder->deleteReadingAfterCursor();
[self _walk];
InputStateInputting *inputting = [self _buildInputtingState];
stateCallback(inputting);
if (!inputting.composingBuffer.length) {
InputStateEmptyIgnoringPreviousState *empty = [[InputStateEmptyIgnoringPreviousState alloc] init];
stateCallback(empty);
} else {
stateCallback(inputting);
}
} else {
errorCallback();
stateCallback(state);