KeyHandler // Improve Alt+Fwd/Bwd support.

This commit is contained in:
ShikiSuen 2022-07-12 15:55:18 +08:00
parent c89636e12a
commit 5f654c842e
2 changed files with 10 additions and 13 deletions

View File

@ -375,8 +375,8 @@ class KeyHandler {
/// ///
var compositorCursorIndex: Int { var compositorCursorIndex: Int {
get { compositor.cursorIndex } get { compositor.cursor }
set { compositor.cursorIndex = newValue } set { compositor.cursor = newValue }
} }
/// ///

View File

@ -662,14 +662,14 @@ extension KeyHandler {
stateCallback(state) stateCallback(state)
} }
} else if input.isOptionHold { } else if input.isOptionHold {
if compositorCursorIndex < compositorLength { //
compositorCursorIndex = nextPhrasePosition if !compositor.jumpCursorBySpan(to: .front) {
stateCallback(buildInputtingState)
} else {
IME.prtDebugIntel("33C3B580") IME.prtDebugIntel("33C3B580")
errorCallback() errorCallback()
stateCallback(state) stateCallback(state)
return true
} }
stateCallback(buildInputtingState)
} else { } else {
if compositorCursorIndex < compositorLength { if compositorCursorIndex < compositorLength {
compositorCursorIndex += 1 compositorCursorIndex += 1
@ -727,17 +727,14 @@ extension KeyHandler {
stateCallback(state) stateCallback(state)
} }
} else if input.isOptionHold { } else if input.isOptionHold {
if compositorCursorIndex > 1 { //
compositorCursorIndex -= 2 if !compositor.jumpCursorBySpan(to: .rear) {
stateCallback(buildInputtingState)
} else if compositorCursorIndex == 1 {
compositorCursorIndex = 0
stateCallback(buildInputtingState)
} else {
IME.prtDebugIntel("8D50DD9E") IME.prtDebugIntel("8D50DD9E")
errorCallback() errorCallback()
stateCallback(state) stateCallback(state)
return true
} }
stateCallback(buildInputtingState)
} else { } else {
if compositorCursorIndex > 0 { if compositorCursorIndex > 0 {
compositorCursorIndex -= 1 compositorCursorIndex -= 1