Repo // Fix selection key errors of vertical IMKCandidates.

This commit is contained in:
ShikiSuen 2022-10-08 18:57:57 +08:00
parent ec35ebf24b
commit 4676c995ce
3 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import Tekkon
/// KeyHandler
public protocol KeyHandlerDelegate {
var selectionKeys: String { get }
var clientBundleIdentifier: String { get }
func candidateController() -> CtlCandidateProtocol
func candidateSelectionCalledByKeyHandler(at index: Int)

View File

@ -232,8 +232,10 @@ extension KeyHandler {
let match: String =
(state.type == .ofAssociates) ? input.inputTextIgnoringModifiers ?? "" : input.text
for j in 0..<PrefMgr.shared.candidateKeys.count {
let label = PrefMgr.shared.candidateKeys.charComponents[j]
let selectionKeys = delegate?.selectionKeys ?? PrefMgr.shared.candidateKeys
for j in 0..<selectionKeys.count {
let label = selectionKeys.charComponents[j]
if match.compare(label, options: .caseInsensitive, range: nil, locale: .current) == .orderedSame {
index = j
break

View File

@ -53,7 +53,9 @@ extension SessionCtl: KeyHandlerDelegate {
// MARK: - Candidate Controller Delegate
extension SessionCtl: CtlCandidateDelegate {
var selectionKeys: String { PrefMgr.shared.candidateKeys }
var selectionKeys: String {
PrefMgr.shared.useIMKCandidateWindow ? "123456789" : PrefMgr.shared.candidateKeys
}
func buzz() {
IMEApp.buzz()