From b488e5bb4f2d0057354c6129ce9821c852b897bb Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 16 Jun 2022 16:53:52 +0800 Subject: [PATCH] KeyHandler // Simplify actualCandidateCursorIndex(). --- .../ControllerModules/KeyHandler_Misc.swift | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler_Misc.swift b/Source/Modules/ControllerModules/KeyHandler_Misc.swift index c2d39f8b..7c9e06c9 100644 --- a/Source/Modules/ControllerModules/KeyHandler_Misc.swift +++ b/Source/Modules/ControllerModules/KeyHandler_Misc.swift @@ -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 的注音需要按照教科書印刷的方式來顯示輕聲,所以這裡處理一下。