diff --git a/MMTextView.m b/MMTextView.m index 1a973314d2..22e7f7d7a4 100644 --- a/MMTextView.m +++ b/MMTextView.m @@ -428,8 +428,6 @@ if ([event type] != NSKeyDown) return; - //NSLog(@"%s%@", _cmd, event); - NSString *chars = [event characters]; NSString *imchars = [event charactersIgnoringModifiers]; unichar c = [chars characterAtIndex:0]; @@ -437,6 +435,8 @@ int len = 0; const char *bytes = 0; + //NSLog(@"%s chars=0x%x unmodchars=0x%x", _cmd, c, imc); + if (' ' == imc && 0xa0 != c) { // HACK! The AppKit turns into which is not standard // Vim behaviour, so bypass this problem. (0xa0 is , which @@ -451,7 +451,12 @@ // HACK! Translate Ctrl+6 to . static char ctrl_hat = 0x1e; len = 1; bytes = &ctrl_hat; - } else { + } else if (c == 0x19 && imc == 0x19) { + // HACK! AppKit turns back tab into Ctrl-Y, so we need to handle it + // separately (else Ctrl-Y doesn't work). + static char back_tab[2] = { 'k', 'B' }; + len = 2; bytes = back_tab; + }else { len = [chars lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; bytes = [chars UTF8String]; } diff --git a/SpecialKeys.plist b/SpecialKeys.plist index 8d91cccc37..ce89630cdf 100644 --- a/SpecialKeys.plist +++ b/SpecialKeys.plist @@ -4,7 +4,7 @@  KA -  + kB kB  kb