InputHandler // Extend upperCaseLetterKeyBehavior().

This commit is contained in:
ShikiSuen 2023-03-11 13:54:00 +08:00
parent c2ea8f254d
commit e4be1ecd3d
1 changed files with 15 additions and 11 deletions

View File

@ -255,22 +255,26 @@ extension InputHandler {
if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold {
if input.isShiftHold { // isOptionHold
switch prefs.upperCaseLetterKeyBehavior {
case 1:
delegate.switchState(IMEState.ofEmpty())
delegate.switchState(IMEState.ofCommitting(textToCommit: inputText.lowercased()))
case 1, 3:
if prefs.upperCaseLetterKeyBehavior == 3, !isConsideredEmptyForNow { break }
let commitText = generateStateOfInputting(sansReading: true).displayedText
delegate.switchState(IMEState.ofCommitting(textToCommit: commitText + inputText.lowercased()))
return true
case 2:
delegate.switchState(IMEState.ofEmpty())
delegate.switchState(IMEState.ofCommitting(textToCommit: inputText.uppercased()))
case 2, 4:
if prefs.upperCaseLetterKeyBehavior == 4, !isConsideredEmptyForNow { break }
let commitText = generateStateOfInputting(sansReading: true).displayedText
delegate.switchState(IMEState.ofCommitting(textToCommit: commitText + inputText.uppercased()))
return true
default: // case 0
default: // case 0
break
}
//
let letter = "_letter_\(inputText)"
if handlePunctuation(letter) {
return true
}
}
}
}
// MARK: - (Still Nothing)