From c79be7f927aff8b2b52a6d8d917b899154ab0ff9 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Fri, 30 Jan 2009 20:34:41 +0100 Subject: [PATCH] Fix 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 work on (some) keyboards where ] requires the use of Alt. --- src/MacVim/MMTextViewHelper.m | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/MMTextViewHelper.m index d1a1bbfe..9e4272ff 100644 --- a/src/MacVim/MMTextViewHelper.m +++ b/src/MacVim/MMTextViewHelper.m @@ -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]; } -- 2.11.4.GIT