From fdad75434e7492225a90614ebe1c600b1a494bc9 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Fri, 12 Aug 2022 00:32:32 +0800 Subject: [PATCH] ctlIME // +useIMKCandidateWindow. --- .../ControllerModules/ctlInputMethod_Core.swift | 3 ++- .../ctlInputMethod_HandleDisplay.swift | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index 2393b1e4..84c0584b 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -25,7 +25,8 @@ class ctlInputMethod: IMKInputController { static var areWeNerfing = false /// 目前在用的的選字窗副本。 - static var ctlCandidateCurrent: ctlCandidateProtocol = ctlCandidateIMK.init(.horizontal) + static var ctlCandidateCurrent: ctlCandidateProtocol = + mgrPrefs.useIMKCandidateWindow ? ctlCandidateIMK.init(.horizontal) : ctlCandidateUniversal.init(.horizontal) /// 工具提示視窗的副本。 static let tooltipController = TooltipController() diff --git a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift index 942f53c7..2ee724b1 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift @@ -66,13 +66,14 @@ extension ctlInputMethod { /// layoutCandidateView 在這裡無法起到糾正作用。 /// 該問題徹底解決的價值並不大,直接等到 macOS 10.x 全線淘汰之後用 SwiftUI 重寫選字窗吧。 - if isCandidateWindowVertical { // 縱排輸入時強制使用縱排選字窗 - ctlInputMethod.ctlCandidateCurrent = ctlCandidateIMK.init(.vertical) - } else if mgrPrefs.useHorizontalCandidateList { - ctlInputMethod.ctlCandidateCurrent = ctlCandidateIMK.init(.horizontal) - } else { - ctlInputMethod.ctlCandidateCurrent = ctlCandidateIMK.init(.vertical) - } + let candidateLayout: CandidateLayout = + ((isCandidateWindowVertical || !mgrPrefs.useHorizontalCandidateList) + ? CandidateLayout.vertical + : CandidateLayout.horizontal) + + ctlInputMethod.ctlCandidateCurrent = + mgrPrefs.useIMKCandidateWindow + ? ctlCandidateIMK.init(candidateLayout) : ctlCandidateUniversal.init(candidateLayout) // set the attributes for the candidate panel (which uses NSAttributedString) let textSize = mgrPrefs.candidateListTextSize