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: - // MARK: -
/// Represents that the composing buffer is empty. /// Represents that the composing buffer is empty.
class EmptyIgnoringPreviousState: InputState { class EmptyIgnoringPreviousState: Empty {
var composingBuffer: String { override var description: String {
""
}
var description: String {
"<InputState.EmptyIgnoringPreviousState>" "<InputState.EmptyIgnoringPreviousState>"
} }
} }

View File

@ -308,7 +308,9 @@ extension ctlInputMethod {
return 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) commit(text: previous.composingBuffer, client: client)
} }
client.setMarkedText( client.setMarkedText(