InputHandler // Reorder when `%quick` inputs are handled.
This commit is contained in:
parent
7df892c541
commit
0a711697bb
|
@ -151,7 +151,7 @@ extension InputHandler {
|
|||
}
|
||||
|
||||
var index: Int?
|
||||
let matched: String = [.ofAssociates, .ofInputting].contains(state.type)
|
||||
let matched: String = [.ofAssociates].contains(state.type)
|
||||
? input.inputTextIgnoringModifiers ?? "" : input.text
|
||||
checkSelectionKey: for keyPair in delegate.selectionKeys.enumerated() {
|
||||
guard matched.lowercased() == keyPair.element.lowercased() else { continue }
|
||||
|
|
|
@ -216,7 +216,6 @@ extension InputHandler {
|
|||
var wildcardKey: String { currentLM.cassetteWildcardKey } // 花牌鍵。
|
||||
let inputText = input.text
|
||||
let isWildcardKeyInput: Bool = (inputText == wildcardKey && !wildcardKey.isEmpty)
|
||||
let calligrapherBackup = calligrapher
|
||||
|
||||
let skipStrokeHandling =
|
||||
input.isReservedKey || input.isNumericPadKey || input.isNonLaptopFunctionKey
|
||||
|
@ -286,13 +285,6 @@ extension InputHandler {
|
|||
}
|
||||
// 向語言模型詢問是否有對應的記錄。
|
||||
if !currentLM.hasUnigramsFor(keyArray: [calligrapher]) {
|
||||
// 此時立即處理 `%quick` 選字行為。
|
||||
let quickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
|
||||
if quickCandidates, handleCandidate(input: input) {
|
||||
if !calligrapher.isEmpty { calligrapher = calligrapherBackup }
|
||||
return true
|
||||
}
|
||||
|
||||
delegate.callError("B49C0979_Cassette:語彙庫內無「\(calligrapher)」的匹配記錄。")
|
||||
calligrapher.removeAll()
|
||||
// 根據「組字器是否為空」來判定回呼哪一種狀態。
|
||||
|
|
|
@ -152,10 +152,8 @@ extension InputHandler {
|
|||
|
||||
let hasQuickCandidates: Bool = state.type == .ofInputting && state.isCandidateContainer
|
||||
|
||||
if input.modifierFlags == .shift {
|
||||
// 處理 `%quick` 選字行為(有摁住 Shift)。
|
||||
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
|
||||
}
|
||||
// 處理 `%quick` 選字行為(有摁住 Shift)。
|
||||
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
|
||||
|
||||
// 注音按鍵輸入與漢音鍵盤符號輸入處理。
|
||||
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {
|
||||
|
@ -164,11 +162,6 @@ extension InputHandler {
|
|||
return compositionHandled
|
||||
}
|
||||
|
||||
if input.modifierFlags != .shift {
|
||||
// 處理 `%quick` 選字行為(沒有摁住 Shift)。
|
||||
guard !(hasQuickCandidates && handleCandidate(input: input)) else { return true }
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// 手動呼叫選字窗。
|
||||
|
|
Loading…
Reference in New Issue