InputHandler // Bind areCandidateKeysShiftPressed().
This commit is contained in:
parent
fa0e98ca4a
commit
a53f96ee2f
|
@ -151,8 +151,12 @@ extension InputHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
var index: Int?
|
var index: Int?
|
||||||
let matched: String = [.ofAssociates].contains(state.type)
|
var shaltShiftHold = [.ofAssociates].contains(state.type)
|
||||||
? input.inputTextIgnoringModifiers ?? "" : input.text
|
if [.ofInputting].contains(state.type) {
|
||||||
|
let cassetteShift = currentLM.areCassetteCandidateKeysShiftPressed
|
||||||
|
shaltShiftHold = shaltShiftHold || cassetteShift
|
||||||
|
}
|
||||||
|
let matched: String = shaltShiftHold ? input.inputTextIgnoringModifiers ?? "" : input.text
|
||||||
checkSelectionKey: for keyPair in delegate.selectionKeys.enumerated() {
|
checkSelectionKey: for keyPair in delegate.selectionKeys.enumerated() {
|
||||||
guard matched.lowercased() == keyPair.element.lowercased() else { continue }
|
guard matched.lowercased() == keyPair.element.lowercased() else { continue }
|
||||||
index = Int(keyPair.offset)
|
index = Int(keyPair.offset)
|
||||||
|
|
|
@ -148,12 +148,14 @@ extension InputHandler {
|
||||||
return handleHaninKeyboardSymbolModeToggle()
|
return handleHaninKeyboardSymbolModeToggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 處理 `%symboldef` 選字行為。
|
||||||
if handleCassetteSymbolTable(input: input) { return true }
|
if handleCassetteSymbolTable(input: input) { return true }
|
||||||
|
|
||||||
|
// 處理 `%quick` 選字行為。
|
||||||
|
var handleQuickCandidate = true
|
||||||
|
if currentLM.areCassetteCandidateKeysShiftPressed { handleQuickCandidate = input.isShiftHold }
|
||||||
let hasQuickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
|
let hasQuickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
|
||||||
|
guard !(hasQuickCandidates && handleQuickCandidate && handleCandidate(input: input)) else { return true }
|
||||||
// 處理 `%quick` 選字行為(有摁住 Shift)。
|
|
||||||
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
|
|
||||||
|
|
||||||
// 注音按鍵輸入與漢音鍵盤符號輸入處理。
|
// 注音按鍵輸入與漢音鍵盤符號輸入處理。
|
||||||
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {
|
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {
|
||||||
|
|
Loading…
Reference in New Issue