From 7561096d0dce9a2edf153e9b52962e368e94a1e9 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 24 Jun 2023 23:38:09 +0800 Subject: [PATCH] Repo // Refine `%quick` experiences with IMKCandidates. --- Source/Modules/InputHandler_HandleComposition.swift | 2 +- Source/Modules/InputHandler_HandleStates.swift | 2 +- Source/Modules/SessionCtl_HandleDisplay.swift | 3 +++ Source/Modules/SessionCtl_IMKCandidatesData.swift | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Modules/InputHandler_HandleComposition.swift b/Source/Modules/InputHandler_HandleComposition.swift index dcc9586b..756a4348 100644 --- a/Source/Modules/InputHandler_HandleComposition.swift +++ b/Source/Modules/InputHandler_HandleComposition.swift @@ -276,7 +276,7 @@ extension InputHandler { fetched = fetched.deduplicated.filter { $0.description != currentLM.nullCandidateInCassette } } result.candidates = fetched.enumerated().map { - (keyArray: [$0.offset.description], value: $0.element.description) + (keyArray: [($0.offset + 1).description], value: $0.element.description) } } delegate.switchState(result) diff --git a/Source/Modules/InputHandler_HandleStates.swift b/Source/Modules/InputHandler_HandleStates.swift index d613d72a..91913e1a 100644 --- a/Source/Modules/InputHandler_HandleStates.swift +++ b/Source/Modules/InputHandler_HandleStates.swift @@ -512,7 +512,7 @@ extension InputHandler { fetched = fetched.deduplicated.filter { $0.description != currentLM.nullCandidateInCassette } } result.candidates = fetched.enumerated().map { - (keyArray: [$0.offset.description], value: $0.element.description) + (keyArray: [($0.offset + 1).description], value: $0.element.description) } } delegate.switchState(result) diff --git a/Source/Modules/SessionCtl_HandleDisplay.swift b/Source/Modules/SessionCtl_HandleDisplay.swift index 92d85fb4..ba5e9c90 100644 --- a/Source/Modules/SessionCtl_HandleDisplay.swift +++ b/Source/Modules/SessionCtl_HandleDisplay.swift @@ -97,6 +97,9 @@ public extension SessionCtl { var singleLine = isVerticalTyping || PrefMgr.shared.candidateWindowShowOnlyOneLine singleLine = singleLine || isInputtingWithCandidates (candidateUI as? CtlCandidateTDK)?.maxLinesPerPage = singleLine ? 1 : 4 + if isInputtingWithCandidates, candidateLayout == .horizontal { + (candidateUI as? CtlCandidateIMK)?.setPanelType(kIMKSingleRowSteppingCandidatePanel) + } candidateUI?.candidateFont = Self.candidateFont( name: PrefMgr.shared.candidateTextFontName, size: PrefMgr.shared.candidateListTextSize diff --git a/Source/Modules/SessionCtl_IMKCandidatesData.swift b/Source/Modules/SessionCtl_IMKCandidatesData.swift index 281c6d73..9a464494 100644 --- a/Source/Modules/SessionCtl_IMKCandidatesData.swift +++ b/Source/Modules/SessionCtl_IMKCandidatesData.swift @@ -54,7 +54,7 @@ public extension SessionCtl { case .ofAssociates: handleIMKCandidatesPrepared(state.candidates, prefix: "⇧") case .ofInputting where state.isCandidateContainer: - handleIMKCandidatesPrepared(state.candidates, prefix: "🗲") + handleIMKCandidatesPrepared(state.candidates) case .ofCandidates: guard !state.candidates.isEmpty else { return .init() } if state.candidates[0].keyArray.joined(separator: "-").contains("_punctuation") { @@ -126,7 +126,7 @@ public extension SessionCtl { case .ofAssociates: fixIndexForIMKCandidates(&indexDeducted, prefix: "⇧", source: candidateString) case .ofInputting where state.isCandidateContainer: - fixIndexForIMKCandidates(&indexDeducted, prefix: "🗲", source: candidateString) + fixIndexForIMKCandidates(&indexDeducted, source: candidateString) case .ofSymbolTable: fixSymbolIndexForIMKCandidates() case .ofCandidates: