InputHandler // Bind a new shortcut for Hanin Keyboard Symbol Input.
This commit is contained in:
parent
b87c9071ca
commit
12a8f3d8ef
|
@ -100,9 +100,18 @@ extension InputHandler {
|
||||||
delegate.switchState(state.convertedToInputting)
|
delegate.switchState(state.convertedToInputting)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: 判斷是否響應傳統的漢音鍵盤符號模式熱鍵。
|
||||||
|
|
||||||
|
if let x = input.inputTextIgnoringModifiers,
|
||||||
|
"¥\\".contains(x), input.modifierFlags.isEmpty,
|
||||||
|
prefs.classicHaninKeyboardSymbolModeShortcutEnabled
|
||||||
|
{
|
||||||
|
return handleHaninKeyboardSymbolModeToggle()
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: 注音按鍵輸入與漢音鍵盤符號輸入處理 (Handle BPMF Keys & Hanin Keyboard Symbol Input)
|
// MARK: 注音按鍵輸入與漢音鍵盤符號輸入處理 (Handle BPMF Keys & Hanin Keyboard Symbol Input)
|
||||||
|
|
||||||
if isHaninKeyboardSymbolMode, input.modifierFlags.isEmpty || input.modifierFlags == .shift {
|
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {
|
||||||
return handleHaninKeyboardSymbolModeInput(input: input)
|
return handleHaninKeyboardSymbolModeInput(input: input)
|
||||||
} else if let compositionHandled = handleComposition(input: input) {
|
} else if let compositionHandled = handleComposition(input: input) {
|
||||||
return compositionHandled
|
return compositionHandled
|
||||||
|
@ -171,10 +180,7 @@ extension InputHandler {
|
||||||
case .option:
|
case .option:
|
||||||
switch (isCodePointInputMode, isHaninKeyboardSymbolMode) {
|
switch (isCodePointInputMode, isHaninKeyboardSymbolMode) {
|
||||||
case (false, false): return handleCodePointInputToggle()
|
case (false, false): return handleCodePointInputToggle()
|
||||||
case (true, false):
|
case (true, false), (false, true):
|
||||||
handleCodePointInputToggle()
|
|
||||||
return handleHaninKeyboardSymbolModeToggle()
|
|
||||||
case (false, true):
|
|
||||||
return handleHaninKeyboardSymbolModeToggle()
|
return handleHaninKeyboardSymbolModeToggle()
|
||||||
default: break
|
default: break
|
||||||
}
|
}
|
||||||
|
|
|
@ -839,6 +839,7 @@ extension InputHandler {
|
||||||
|
|
||||||
@discardableResult func handleHaninKeyboardSymbolModeToggle() -> Bool {
|
@discardableResult func handleHaninKeyboardSymbolModeToggle() -> Bool {
|
||||||
guard let delegate = delegate, delegate.state.type != .ofDeactivated else { return false }
|
guard let delegate = delegate, delegate.state.type != .ofDeactivated else { return false }
|
||||||
|
if isCodePointInputMode { isCodePointInputMode = false }
|
||||||
if isHaninKeyboardSymbolMode {
|
if isHaninKeyboardSymbolMode {
|
||||||
isHaninKeyboardSymbolMode = false
|
isHaninKeyboardSymbolMode = false
|
||||||
delegate.switchState(IMEState.ofAbortion())
|
delegate.switchState(IMEState.ofAbortion())
|
||||||
|
|
Loading…
Reference in New Issue