diff --git a/src/MacVim/MMAtsuiTextView.m b/src/MacVim/MMAtsuiTextView.m index 9ea9fb5b93..3e4b73a667 100644 --- a/src/MacVim/MMAtsuiTextView.m +++ b/src/MacVim/MMAtsuiTextView.m @@ -261,11 +261,16 @@ enum { //NSLog(@"%s %@", _cmd, event); // HACK! If control modifier is held, don't pass the event along to // interpretKeyEvents: since some keys are bound to multiple commands which - // means doCommandBySelector: is called several times. + // means doCommandBySelector: is called several times. Do the same for + // Alt+Function key presses (Alt+Up and Alt+Down are bound to two + // commands). This hack may break input management, but unless we can + // figure out a way to disable key bindings there seems little else to do. // // TODO: Figure out a way to disable Cocoa key bindings entirely, without // affecting input management. - if ([event modifierFlags] & NSControlKeyMask) { + 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) { diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m index b1e7148c95..3d7df765c0 100644 --- a/src/MacVim/MMTextView.m +++ b/src/MacVim/MMTextView.m @@ -487,11 +487,16 @@ enum { //NSLog(@"%s %@", _cmd, event); // HACK! If control modifier is held, don't pass the event along to // interpretKeyEvents: since some keys are bound to multiple commands which - // means doCommandBySelector: is called several times. + // means doCommandBySelector: is called several times. Do the same for + // Alt+Function key presses (Alt+Up and Alt+Down are bound to two + // commands). This hack may break input management, but unless we can + // figure out a way to disable key bindings there seems little else to do. // // TODO: Figure out a way to disable Cocoa key bindings entirely, without // affecting input management. - if ([event modifierFlags] & NSControlKeyMask) { + 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) {