Fix the working of Ctrl-6

Call interpretKeyEvents: with except Ctrl-O and Ctrl-U since should
translate key-input by doCommandBySelector:.
This commit is contained in:
ichizok
2018-11-22 03:19:39 +09:00
parent 8fbb254859
commit 7c6b2b0e86
+9 -6
View File
@@ -170,18 +170,21 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
&& [unmod length] == 1
&& ([unmod characterAtIndex:0] == '6' ||
[unmod characterAtIndex:0] == '^')) {
// HACK! interpretKeyEvents: does not call doCommandBySelector:
// HACK! interpretKeyEvents: does not call doCommandBySelector:
// with Ctrl-6 or Ctrl-^ when IM is active.
[self doKeyDown:@"\x1e"];
string = nil;
} else {
// When using JapaneseIM with "Windows-like shortcuts" turned on,
// HACK! When using JapaneseIM with "Windows-like shortcuts" turned on,
// interpretKeyEvents: does not call doCommandBySelector: with Ctrl-O
// and Ctrl-U (why?), so we cannot handle them at all.
// As a workaround, we do not call interpretKeyEvents: when no marked
// text and with only control-modifier.
if ([self hasMarkedText] || (!modControl || modCommand || modOption)) {
// HACK! interpretKeyEvents: may call insertText: or
// As a workaround, we do not call interpretKeyEvents: with Ctrl-O or
// Ctrl-U when there is no marked text.
if ([self hasMarkedText]
|| !((modControl && !modCommand && !modOption)
&& ([unmod characterAtIndex:0] == 'o' ||
[unmod characterAtIndex:0] == 'u'))) {
// HACK! interpretKeyEvents: may call insertText: or
// doCommandBySelector:, or it may swallow the key (most likely the
// current input method used it). In the first two cases we have to
// manually set the below flag to NO if the key wasn't handled.