Repo // Force Shift+Candidate in `%quick` mode in some cases.

This commit is contained in:
ShikiSuen 2023-06-18 11:08:57 +08:00
parent 2a5f02601c
commit 276555ed95
3 changed files with 20 additions and 6 deletions

View File

@ -151,8 +151,8 @@ extension InputHandler {
}
var index: Int?
let matched: String =
(state.type == .ofAssociates) ? input.inputTextIgnoringModifiers ?? "" : input.text
var matched: String = [.ofAssociates, .ofInputting].contains(state.type)
? input.inputTextIgnoringModifiers ?? "" : input.text
checkSelectionKey: for keyPair in delegate.selectionKeys.enumerated() {
guard matched.lowercased() == keyPair.element.lowercased() else { continue }
index = Int(keyPair.offset)

View File

@ -138,6 +138,8 @@ extension InputHandler {
return true
}
// -----
//
haninSymbolInput: if prefs.classicHaninKeyboardSymbolModeShortcutEnabled {
guard let x = input.inputTextIgnoringModifiers,
@ -146,6 +148,13 @@ extension InputHandler {
return handleHaninKeyboardSymbolModeToggle()
}
let hasQuickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
if input.modifierFlags == .shift {
// `%quick` Shift
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
}
//
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {
return handleHaninKeyboardSymbolModeInput(input: input)
@ -153,9 +162,12 @@ extension InputHandler {
return compositionHandled
}
// `%quick`
let quickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
guard !(quickCandidates && handleCandidate(input: input)) else { return true }
if input.modifierFlags != .shift {
// `%quick` Shift
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
}
// -----
//
if callCandidateState(input: input) { return true }

View File

@ -106,8 +106,10 @@ public extension SessionCtl {
candidateUI?.tooltip =
singleLine ? "" : NSLocalizedString("Hold ⇧ to choose associates.", comment: "")
} else if state.type == .ofInputting, state.isCandidateContainer {
let useShift = !PrefMgr.shared.autoCompositeWithLongestPossibleCassetteKey
let theEmoji = useShift ? "⬆️" : "⚡️"
candidateUI?.tooltip =
singleLine ? "⚡️" : "⚡️ " + NSLocalizedString("Quick Candidates", comment: "")
singleLine ? theEmoji : "\(theEmoji) " + NSLocalizedString("Quick Candidates", comment: "")
} else if PrefMgr.shared.cassetteEnabled {
candidateUI?.tooltip =
singleLine ? "📼" : "📼 " + NSLocalizedString("CIN Cassette Mode", comment: "")