InputHandler // Bring cursor jump to the marking mode.
* Certain models of ThinkPad USB Keyboard don't support Alt+Shift+→, hence the choice of Command key as the alternative modifier key for this function.
This commit is contained in:
parent
c5b3083b48
commit
03913cb71c
|
@ -195,9 +195,13 @@ extension InputHandler {
|
||||||
// Shift + Left
|
// Shift + Left
|
||||||
if input.isCursorBackward, input.isShiftHold {
|
if input.isCursorBackward, input.isShiftHold {
|
||||||
if compositor.marker > 0 {
|
if compositor.marker > 0 {
|
||||||
compositor.marker -= 1
|
if input.isCommandHold || input.isOptionHold {
|
||||||
if isCursorCuttingChar(isMarker: true) {
|
|
||||||
compositor.jumpCursorBySpan(to: .rear, isMarker: true)
|
compositor.jumpCursorBySpan(to: .rear, isMarker: true)
|
||||||
|
} else {
|
||||||
|
compositor.marker -= 1
|
||||||
|
if isCursorCuttingChar(isMarker: true) {
|
||||||
|
compositor.jumpCursorBySpan(to: .rear, isMarker: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var marking = IMEState.ofMarking(
|
var marking = IMEState.ofMarking(
|
||||||
displayTextSegments: state.displayTextSegments,
|
displayTextSegments: state.displayTextSegments,
|
||||||
|
@ -216,9 +220,13 @@ extension InputHandler {
|
||||||
// Shift + Right
|
// Shift + Right
|
||||||
if input.isCursorForward, input.isShiftHold {
|
if input.isCursorForward, input.isShiftHold {
|
||||||
if compositor.marker < compositor.length {
|
if compositor.marker < compositor.length {
|
||||||
compositor.marker += 1
|
if input.isCommandHold || input.isOptionHold {
|
||||||
if isCursorCuttingChar(isMarker: true) {
|
|
||||||
compositor.jumpCursorBySpan(to: .front, isMarker: true)
|
compositor.jumpCursorBySpan(to: .front, isMarker: true)
|
||||||
|
} else {
|
||||||
|
compositor.marker += 1
|
||||||
|
if isCursorCuttingChar(isMarker: true) {
|
||||||
|
compositor.jumpCursorBySpan(to: .front, isMarker: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var marking = IMEState.ofMarking(
|
var marking = IMEState.ofMarking(
|
||||||
displayTextSegments: state.displayTextSegments,
|
displayTextSegments: state.displayTextSegments,
|
||||||
|
@ -644,9 +652,14 @@ extension InputHandler {
|
||||||
if input.isShiftHold {
|
if input.isShiftHold {
|
||||||
// Shift + Right
|
// Shift + Right
|
||||||
if compositor.cursor < compositor.length {
|
if compositor.cursor < compositor.length {
|
||||||
compositor.marker = compositor.cursor + 1
|
compositor.marker = compositor.cursor
|
||||||
if isCursorCuttingChar(isMarker: true) {
|
if input.isCommandHold || input.isOptionHold {
|
||||||
compositor.jumpCursorBySpan(to: .front, isMarker: true)
|
compositor.jumpCursorBySpan(to: .front, isMarker: true)
|
||||||
|
} else {
|
||||||
|
compositor.marker += 1
|
||||||
|
if isCursorCuttingChar(isMarker: true) {
|
||||||
|
compositor.jumpCursorBySpan(to: .front, isMarker: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var marking = IMEState.ofMarking(
|
var marking = IMEState.ofMarking(
|
||||||
displayTextSegments: compositor.walkedNodes.values,
|
displayTextSegments: compositor.walkedNodes.values,
|
||||||
|
@ -659,7 +672,7 @@ extension InputHandler {
|
||||||
} else {
|
} else {
|
||||||
delegate.callError("BB7F6DB9")
|
delegate.callError("BB7F6DB9")
|
||||||
}
|
}
|
||||||
} else if input.isOptionHold {
|
} else if input.isOptionHold, !input.isShiftHold {
|
||||||
if input.isControlHold {
|
if input.isControlHold {
|
||||||
return handleEnd()
|
return handleEnd()
|
||||||
}
|
}
|
||||||
|
@ -703,9 +716,14 @@ extension InputHandler {
|
||||||
if input.isShiftHold {
|
if input.isShiftHold {
|
||||||
// Shift + left
|
// Shift + left
|
||||||
if compositor.cursor > 0 {
|
if compositor.cursor > 0 {
|
||||||
compositor.marker = compositor.cursor - 1
|
compositor.marker = compositor.cursor
|
||||||
if isCursorCuttingChar(isMarker: true) {
|
if input.isCommandHold || input.isOptionHold {
|
||||||
compositor.jumpCursorBySpan(to: .rear, isMarker: true)
|
compositor.jumpCursorBySpan(to: .rear, isMarker: true)
|
||||||
|
} else {
|
||||||
|
compositor.marker -= 1
|
||||||
|
if isCursorCuttingChar(isMarker: true) {
|
||||||
|
compositor.jumpCursorBySpan(to: .rear, isMarker: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var marking = IMEState.ofMarking(
|
var marking = IMEState.ofMarking(
|
||||||
displayTextSegments: compositor.walkedNodes.values,
|
displayTextSegments: compositor.walkedNodes.values,
|
||||||
|
@ -718,7 +736,7 @@ extension InputHandler {
|
||||||
} else {
|
} else {
|
||||||
delegate.callError("D326DEA3")
|
delegate.callError("D326DEA3")
|
||||||
}
|
}
|
||||||
} else if input.isOptionHold {
|
} else if input.isOptionHold, !input.isShiftHold {
|
||||||
if input.isControlHold { return handleHome() }
|
if input.isControlHold { return handleHome() }
|
||||||
// 游標跳轉動作無論怎樣都會執行,但如果出了執行失敗的結果的話則觸發報錯流程。
|
// 游標跳轉動作無論怎樣都會執行,但如果出了執行失敗的結果的話則觸發報錯流程。
|
||||||
if !compositor.jumpCursorBySpan(to: .rear) {
|
if !compositor.jumpCursorBySpan(to: .rear) {
|
||||||
|
|
Loading…
Reference in New Issue