KeyHandler // Refactor handleDelete().

This commit is contained in:
ShikiSuen 2022-06-30 22:22:53 +08:00
parent 361447faac
commit 5c6a2078b2
1 changed files with 14 additions and 17 deletions

View File

@ -473,28 +473,25 @@ extension KeyHandler {
) -> Bool {
guard state is InputState.Inputting else { return false }
if composer.isEmpty {
if compositorCursorIndex != compositorLength {
guard composer.isEmpty else {
IME.prtDebugIntel("9C69908D")
errorCallback()
stateCallback(state)
return true
}
guard compositorCursorIndex != compositorLength else {
IME.prtDebugIntel("9B69938D")
errorCallback()
stateCallback(state)
return true
}
deleteCompositorReadingToTheFrontOfCursor()
walk()
let inputting = buildInputtingState
// count > 0!isEmpty滿
if inputting.composingBuffer.isEmpty {
stateCallback(InputState.EmptyIgnoringPreviousState())
} else {
stateCallback(inputting)
}
} else {
IME.prtDebugIntel("9B69938D")
errorCallback()
stateCallback(state)
}
} else {
IME.prtDebugIntel("9C69908D")
errorCallback()
stateCallback(state)
}
stateCallback(inputting.composingBuffer.isEmpty ? InputState.EmptyIgnoringPreviousState() : inputting)
return true
}