InputHandler // Allow moving cursor in candidate state.
- The hotkey is (Shift+)Opt+FWD/BWD.
This commit is contained in:
parent
24cf7e9971
commit
aac80eba7d
|
@ -150,6 +150,42 @@ extension InputHandler {
|
||||||
_ = ctlCandidate.showPreviousPage() ? {}() : delegate.callError("9569955D")
|
_ = ctlCandidate.showPreviousPage() ? {}() : delegate.callError("9569955D")
|
||||||
return true
|
return true
|
||||||
case .kUpArrow, .kDownArrow, .kLeftArrow, .kRightArrow:
|
case .kUpArrow, .kDownArrow, .kLeftArrow, .kRightArrow:
|
||||||
|
switch input.commonKeyModifierFlags {
|
||||||
|
case [.option, .shift] where input.isCursorForward:
|
||||||
|
if compositor.cursor < compositor.length {
|
||||||
|
compositor.cursor += 1
|
||||||
|
if isCursorCuttingChar() { compositor.jumpCursorBySpan(to: .front) }
|
||||||
|
delegate.switchState(generateStateOfCandidates())
|
||||||
|
} else {
|
||||||
|
delegate.callError("D3006C85")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case [.option, .shift] where input.isCursorBackward:
|
||||||
|
if compositor.cursor > 0 {
|
||||||
|
compositor.cursor -= 1
|
||||||
|
if isCursorCuttingChar() { compositor.jumpCursorBySpan(to: .rear) }
|
||||||
|
delegate.switchState(generateStateOfCandidates())
|
||||||
|
} else {
|
||||||
|
delegate.callError("DE9DAF0D")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case .option where input.isCursorForward:
|
||||||
|
if compositor.cursor < compositor.length {
|
||||||
|
compositor.jumpCursorBySpan(to: .front)
|
||||||
|
delegate.switchState(generateStateOfCandidates())
|
||||||
|
} else {
|
||||||
|
delegate.callError("5D9F4819")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
case .option where input.isCursorBackward:
|
||||||
|
if compositor.cursor > 0 {
|
||||||
|
compositor.jumpCursorBySpan(to: .rear)
|
||||||
|
delegate.switchState(generateStateOfCandidates())
|
||||||
|
} else {
|
||||||
|
delegate.callError("34B6322D")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
default:
|
||||||
handleArrowKey: switch (keyCodeType, ctlCandidate.currentLayout) {
|
handleArrowKey: switch (keyCodeType, ctlCandidate.currentLayout) {
|
||||||
case (.kLeftArrow, .horizontal), (.kUpArrow, .vertical): // Previous Candidate
|
case (.kLeftArrow, .horizontal), (.kUpArrow, .vertical): // Previous Candidate
|
||||||
_ = ctlCandidate.highlightPreviousCandidate()
|
_ = ctlCandidate.highlightPreviousCandidate()
|
||||||
|
@ -161,6 +197,8 @@ extension InputHandler {
|
||||||
_ = ctlCandidate.showNextLine()
|
_ = ctlCandidate.showNextLine()
|
||||||
default: break handleArrowKey
|
default: break handleArrowKey
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
case .kHome:
|
case .kHome:
|
||||||
_ =
|
_ =
|
||||||
(ctlCandidate.highlightedIndex == 0)
|
(ctlCandidate.highlightedIndex == 0)
|
||||||
|
|
Loading…
Reference in New Issue