KeyHandler // Redefine how Shift+BackSpace behaves.

* Also implement Shift+Option+BackSpace.
This commit is contained in:
ShikiSuen 2022-08-23 11:36:37 +08:00
parent 22ab54dfa9
commit e5548fc7b4
1 changed files with 19 additions and 1 deletions

View File

@ -409,7 +409,25 @@ extension KeyHandler {
) -> Bool { ) -> Bool {
guard state is InputState.Inputting else { return false } guard state is InputState.Inputting else { return false }
if input.isShiftHold { // macOS Shift+BackSpace
switch mgrPrefs.specifyShiftBackSpaceKeyBehavior {
case 0:
guard input.isShiftHold, composer.isEmpty else { break }
guard let prevReading = previousParsableReading else { break }
// prevReading 調調
compositor.dropKey(direction: .rear)
walk() // Walk walk
prevReading.1.charComponents.forEach { composer.receiveKey(fromPhonabet: $0) }
stateCallback(buildInputtingState)
return true
case 1:
stateCallback(InputState.EmptyIgnoringPreviousState())
stateCallback(InputState.Empty())
return true
default: break
}
if input.isShiftHold, input.isOptionHold {
stateCallback(InputState.EmptyIgnoringPreviousState()) stateCallback(InputState.EmptyIgnoringPreviousState())
stateCallback(InputState.Empty()) stateCallback(InputState.Empty())
return true return true