KeyHandler // Refactor handleDelete().
This commit is contained in:
parent
361447faac
commit
5c6a2078b2
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue