Fix <C-]> on German keyboard layout

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.
This commit is contained in:
Bjorn Winckler
2009-01-30 20:34:41 +01:00
parent 8502d5f2b2
commit b8c8a68a5c
+7 -8
View File
@@ -102,14 +102,13 @@ static float MMDragAreaSize = 73.0f;
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];
}