KeyHandler // Simplify actualCandidateCursorIndex().

This commit is contained in:
ShikiSuen 2022-06-16 16:53:52 +08:00
parent ab62321f7a
commit b488e5bb4f
1 changed files with 1 additions and 24 deletions

View File

@ -34,30 +34,7 @@ extension KeyHandler {
}
var actualCandidateCursorIndex: Int {
var cursorIndex = compositorCursorIndex
switch mgrPrefs.useRearCursorMode {
case false:
do {
// macOS built-in Zhuyin style.
// (i.e. the cursor is always in front of the phrase.)
// No crossing.
switch cursorIndex {
case 0: cursorIndex = 1
default: break
}
}
case true:
do {
// Microsoft new phonetics style.
// (i.e. the cursor is always at the rear of the phrase.)
// No crossing.
switch cursorIndex {
case compositorLength: cursorIndex -= 1
default: break
}
}
}
return cursorIndex
mgrPrefs.useRearCursorMode ? min(compositorCursorIndex, compositorLength - 1) : max(compositorCursorIndex, 1)
}
// Ruby