InputHandler // Bind a new shortcut for Hanin Keyboard Symbol Input.

This commit is contained in:
ShikiSuen 2023-02-12 12:57:57 +08:00
parent b87c9071ca
commit 12a8f3d8ef
2 changed files with 12 additions and 5 deletions

View File

@ -100,9 +100,18 @@ extension InputHandler {
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)
if isHaninKeyboardSymbolMode, input.modifierFlags.isEmpty || input.modifierFlags == .shift {
if isHaninKeyboardSymbolMode, [[], .shift].contains(input.modifierFlags) {
return handleHaninKeyboardSymbolModeInput(input: input)
} else if let compositionHandled = handleComposition(input: input) {
return compositionHandled
@ -171,10 +180,7 @@ extension InputHandler {
case .option:
switch (isCodePointInputMode, isHaninKeyboardSymbolMode) {
case (false, false): return handleCodePointInputToggle()
case (true, false):
handleCodePointInputToggle()
return handleHaninKeyboardSymbolModeToggle()
case (false, true):
case (true, false), (false, true):
return handleHaninKeyboardSymbolModeToggle()
default: break
}

View File

@ -839,6 +839,7 @@ extension InputHandler {
@discardableResult func handleHaninKeyboardSymbolModeToggle() -> Bool {
guard let delegate = delegate, delegate.state.type != .ofDeactivated else { return false }
if isCodePointInputMode { isCodePointInputMode = false }
if isHaninKeyboardSymbolMode {
isHaninKeyboardSymbolMode = false
delegate.switchState(IMEState.ofAbortion())