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
c2a77b4643
commit
659d541f09
|
@ -272,29 +272,35 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
return NO;
|
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]) {
|
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
|
// 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.
|
// process all possible combination, we hope.
|
||||||
[self clear];
|
[self clear];
|
||||||
InputStateEmpty *emptyState = [[InputStateEmpty alloc] init];
|
InputStateEmpty *emptyState = [[InputStateEmpty alloc] init];
|
||||||
stateCallback(emptyState);
|
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]) {
|
if ([input isShiftHold]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if ASCII but not printable, don't use insertText:replacementRange: as many apps don't handle non-ASCII char insertions.
|
// 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)) {
|
if (charCode < 0x80 && !isprint(charCode)) {
|
||||||
return NO;
|
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]];
|
InputStateCommitting *committingState = [[InputStateCommitting alloc] initWithPoppedText:[input.inputText lowercaseString]];
|
||||||
stateCallback(committingState);
|
stateCallback(committingState);
|
||||||
stateCallback(emptyState);
|
stateCallback(emptyState);
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue