Repo // Force Shift+Candidate in `%quick` mode in some cases.
This commit is contained in:
parent
2a5f02601c
commit
276555ed95
|
@ -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)
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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: "")
|
||||
|
|
Loading…
Reference in New Issue