InputState // Recognize EmptyIgnoringPreviousState as Empty.

- The only difference is that EmptyIgnoringPreviousState doesn't commit the contents of the previous state.
This commit is contained in:
ShikiSuen 2022-05-31 14:28:33 +08:00
parent 910a047a5b
commit 13d2569919
2 changed files with 5 additions and 7 deletions

View File

@ -83,12 +83,8 @@ class InputState {
// MARK: -
/// Represents that the composing buffer is empty.
class EmptyIgnoringPreviousState: InputState {
var composingBuffer: String {
""
}
var description: String {
class EmptyIgnoringPreviousState: Empty {
override var description: String {
"<InputState.EmptyIgnoringPreviousState>"
}
}

View File

@ -308,7 +308,9 @@ extension ctlInputMethod {
return
}
if let previous = previous as? InputState.NotEmpty {
if let previous = previous as? InputState.NotEmpty,
!(state is InputState.EmptyIgnoringPreviousState)
{
commit(text: previous.composingBuffer, client: client)
}
client.setMarkedText(