Skip to content

Commit 7c6b2b0

Browse files
committed
Fix the working of Ctrl-6
Call interpretKeyEvents: with except Ctrl-O and Ctrl-U since should translate key-input by doCommandBySelector:.
1 parent 8fbb254 commit 7c6b2b0

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/MacVim/MMTextViewHelper.m

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,21 @@ - (void)keyDown:(NSEvent *)event
170170
&& [unmod length] == 1
171171
&& ([unmod characterAtIndex:0] == '6' ||
172172
[unmod characterAtIndex:0] == '^')) {
173-
// HACK! interpretKeyEvents: does not call doCommandBySelector:
173+
// HACK! interpretKeyEvents: does not call doCommandBySelector:
174174
// with Ctrl-6 or Ctrl-^ when IM is active.
175175
[self doKeyDown:@"\x1e"];
176176
string = nil;
177177
} else {
178-
// When using JapaneseIM with "Windows-like shortcuts" turned on,
178+
// HACK! When using JapaneseIM with "Windows-like shortcuts" turned on,
179179
// interpretKeyEvents: does not call doCommandBySelector: with Ctrl-O
180180
// and Ctrl-U (why?), so we cannot handle them at all.
181-
// As a workaround, we do not call interpretKeyEvents: when no marked
182-
// text and with only control-modifier.
183-
if ([self hasMarkedText] || (!modControl || modCommand || modOption)) {
184-
// HACK! interpretKeyEvents: may call insertText: or
181+
// As a workaround, we do not call interpretKeyEvents: with Ctrl-O or
182+
// Ctrl-U when there is no marked text.
183+
if ([self hasMarkedText]
184+
|| !((modControl && !modCommand && !modOption)
185+
&& ([unmod characterAtIndex:0] == 'o' ||
186+
[unmod characterAtIndex:0] == 'u'))) {
187+
// HACK! interpretKeyEvents: may call insertText: or
185188
// doCommandBySelector:, or it may swallow the key (most likely the
186189
// current input method used it). In the first two cases we have to
187190
// manually set the below flag to NO if the key wasn't handled.

0 commit comments

Comments
 (0)