KeyHandler // Simplify actualCandidateCursorIndex().
This commit is contained in:
parent
ab62321f7a
commit
b488e5bb4f
|
@ -34,30 +34,7 @@ extension KeyHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
var actualCandidateCursorIndex: Int {
|
var actualCandidateCursorIndex: Int {
|
||||||
var cursorIndex = compositorCursorIndex
|
mgrPrefs.useRearCursorMode ? min(compositorCursorIndex, compositorLength - 1) : max(compositorCursorIndex, 1)
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用於網頁 Ruby 的注音需要按照教科書印刷的方式來顯示輕聲,所以這裡處理一下。
|
// 用於網頁 Ruby 的注音需要按照教科書印刷的方式來顯示輕聲,所以這裡處理一下。
|
||||||
|
|
Loading…
Reference in New Issue