Skip to content

Commit

Permalink
Fix <C-]> on German keyboard layout
Browse files Browse the repository at this point in the history
Instead of checking for Ctrl-character, check when Cocoa translates a
keypress to an unprintable character (in particular, this happens on
Ctrl-character).  This ensures keys like <C-]> work on (some) keyboards
where ] requires the use of Alt.
  • Loading branch information
b4winckler committed Jan 30, 2009
1 parent 8502d5f commit b8c8a68
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/MacVim/MMTextViewHelper.m
Expand Up @@ -102,14 +102,13 @@ - (void)keyDown:(NSEvent *)event
int flags = [event modifierFlags];
if ((flags & NSControlKeyMask) ||
((flags & NSAlternateKeyMask) && (flags & NSFunctionKeyMask))) {
NSString *unmod = [event charactersIgnoringModifiers];
if ([unmod length] == 1 && [unmod characterAtIndex:0] <= 0x7f
&& [unmod characterAtIndex:0] >= 0x60) {
// HACK! Send Ctrl-letter keys (and C-@, C-[, C-\, C-], C-^, C-_)
// as normal text to be added to the Vim input buffer. This must
// be done in order for the backend to be able to separate e.g.
// Ctrl-i and Ctrl-tab.
[self insertText:[event characters]];
NSString *chars = [event characters];
if ([chars length] == 1 && [chars characterAtIndex:0] < 0x20) {
// HACK! Send unprintable characters (such as C-@, C-[, C-\, C-],
// C-^, C-_) as normal text to be added to the Vim input buffer.
// This must be done in order for the backend to be able to
// separate e.g. Ctrl-i and Ctrl-tab.
[self insertText:chars];
} else {
[self dispatchKeyEvent:event];
}
Expand Down

0 comments on commit b8c8a68

Please sign in to comment.