KeyHandler // Let alphanumerical mode respect AppleKeyboardConverter.
- Note that Apple Dynamic Keyboard Layout users need to press'n'hold ALT+SHIFT when typing uppercase letters. If this brings you inconveniences or causes hotkey conflicts with the app you are using, please consider using static keyboard layouts (like US keyboard layout, etc.) instead which sacrifices the on-screen bopomofo keyboard.
This commit is contained in:
parent
9b365a951d
commit
597693abe1
|
@ -272,29 +272,35 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
return NO;
|
||||
}
|
||||
|
||||
// Caps Lock processing : if Caps Lock is on or Preferences.isAlphanumericalModeEnabled, temporarily disable bopomofo.
|
||||
// Caps Lock processing: if Caps Lock is on or Preferences.isAlphanumericalModeEnabled, temporarily disable bopomofo.
|
||||
// Also: Alphanumerical mode processing.
|
||||
if ([input isBackSpace] || [input isEnter] || [input isAbsorbedArrowKey] || [input isExtraChooseCandidateKey] || [input isExtraChooseCandidateKeyReverse] || [input isCursorForward] || [input isCursorBackward]) {
|
||||
// do nothing if backspace is pressed -- we ignore the key
|
||||
} else if ([input isCapsLockOn] || Preferences.isAlphanumericalModeEnabled) {
|
||||
} else if (Preferences.isAlphanumericalModeEnabled || [input isCapsLockOn]) {
|
||||
// process all possible combination, we hope.
|
||||
[self clear];
|
||||
InputStateEmpty *emptyState = [[InputStateEmpty alloc] init];
|
||||
stateCallback(emptyState);
|
||||
|
||||
// first commit everything in the buffer.
|
||||
// Non-Dynamic Keyboard Layouts Only: When shift is pressed, don't do further processing, since it outputs capital letter anyway.
|
||||
if ((![Preferences.basisKeyboardLayout isEqual: @"com.apple.keylayout.ZhuyinBopomofo"]
|
||||
&& ![Preferences.basisKeyboardLayout isEqual: @"com.apple.keylayout.ZhuyinEten"])
|
||||
|| [input isCapsLockOn]){
|
||||
if ([input isShiftHold]) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
// if ASCII but not printable, don't use insertText:replacementRange: as many apps don't handle non-ASCII char insertions.
|
||||
if (charCode < 0x80 && !isprint(charCode)) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
// when shift is pressed, don't do further processing, since it outputs capital letter anyway.
|
||||
// commit everything in the buffer.
|
||||
InputStateCommitting *committingState = [[InputStateCommitting alloc] initWithPoppedText:[input.inputText lowercaseString]];
|
||||
stateCallback(committingState);
|
||||
stateCallback(emptyState);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue