Repo // Refine `%quick` experiences with IMKCandidates.

This commit is contained in:
ShikiSuen 2023-06-24 23:38:09 +08:00
parent 723437d085
commit 7561096d0d
4 changed files with 7 additions and 4 deletions

View File

@ -276,7 +276,7 @@ extension InputHandler {
fetched = fetched.deduplicated.filter { $0.description != currentLM.nullCandidateInCassette } fetched = fetched.deduplicated.filter { $0.description != currentLM.nullCandidateInCassette }
} }
result.candidates = fetched.enumerated().map { 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) delegate.switchState(result)

View File

@ -512,7 +512,7 @@ extension InputHandler {
fetched = fetched.deduplicated.filter { $0.description != currentLM.nullCandidateInCassette } fetched = fetched.deduplicated.filter { $0.description != currentLM.nullCandidateInCassette }
} }
result.candidates = fetched.enumerated().map { 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) delegate.switchState(result)

View File

@ -97,6 +97,9 @@ public extension SessionCtl {
var singleLine = isVerticalTyping || PrefMgr.shared.candidateWindowShowOnlyOneLine var singleLine = isVerticalTyping || PrefMgr.shared.candidateWindowShowOnlyOneLine
singleLine = singleLine || isInputtingWithCandidates singleLine = singleLine || isInputtingWithCandidates
(candidateUI as? CtlCandidateTDK)?.maxLinesPerPage = singleLine ? 1 : 4 (candidateUI as? CtlCandidateTDK)?.maxLinesPerPage = singleLine ? 1 : 4
if isInputtingWithCandidates, candidateLayout == .horizontal {
(candidateUI as? CtlCandidateIMK)?.setPanelType(kIMKSingleRowSteppingCandidatePanel)
}
candidateUI?.candidateFont = Self.candidateFont( candidateUI?.candidateFont = Self.candidateFont(
name: PrefMgr.shared.candidateTextFontName, size: PrefMgr.shared.candidateListTextSize name: PrefMgr.shared.candidateTextFontName, size: PrefMgr.shared.candidateListTextSize

View File

@ -54,7 +54,7 @@ public extension SessionCtl {
case .ofAssociates: case .ofAssociates:
handleIMKCandidatesPrepared(state.candidates, prefix: "") handleIMKCandidatesPrepared(state.candidates, prefix: "")
case .ofInputting where state.isCandidateContainer: case .ofInputting where state.isCandidateContainer:
handleIMKCandidatesPrepared(state.candidates, prefix: "🗲") handleIMKCandidatesPrepared(state.candidates)
case .ofCandidates: case .ofCandidates:
guard !state.candidates.isEmpty else { return .init() } guard !state.candidates.isEmpty else { return .init() }
if state.candidates[0].keyArray.joined(separator: "-").contains("_punctuation") { if state.candidates[0].keyArray.joined(separator: "-").contains("_punctuation") {
@ -126,7 +126,7 @@ public extension SessionCtl {
case .ofAssociates: case .ofAssociates:
fixIndexForIMKCandidates(&indexDeducted, prefix: "", source: candidateString) fixIndexForIMKCandidates(&indexDeducted, prefix: "", source: candidateString)
case .ofInputting where state.isCandidateContainer: case .ofInputting where state.isCandidateContainer:
fixIndexForIMKCandidates(&indexDeducted, prefix: "🗲", source: candidateString) fixIndexForIMKCandidates(&indexDeducted, source: candidateString)
case .ofSymbolTable: case .ofSymbolTable:
fixSymbolIndexForIMKCandidates() fixSymbolIndexForIMKCandidates()
case .ofCandidates: case .ofCandidates: