InputHandler // Bind areCandidateKeysShiftPressed().

This commit is contained in:
ShikiSuen 2023-06-20 17:19:49 +08:00
parent fa0e98ca4a
commit a53f96ee2f
2 changed files with 11 additions and 5 deletions

View File

@ -151,8 +151,12 @@ extension InputHandler {
}
var index: Int?
let matched: String = [.ofAssociates].contains(state.type)
? input.inputTextIgnoringModifiers ?? "" : input.text
var shaltShiftHold = [.ofAssociates].contains(state.type)
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() {
guard matched.lowercased() == keyPair.element.lowercased() else { continue }
index = Int(keyPair.offset)

View File

@ -148,12 +148,14 @@ extension InputHandler {
return handleHaninKeyboardSymbolModeToggle()
}
// `%symboldef`
if handleCassetteSymbolTable(input: input) { return true }
// `%quick`
var handleQuickCandidate = true
if currentLM.areCassetteCandidateKeysShiftPressed { handleQuickCandidate = input.isShiftHold }
let hasQuickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
// `%quick` Shift
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
guard !(hasQuickCandidates && handleQuickCandidate && handleCandidate(input: input)) else { return true }
//
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {