Fixed out of range exception in insertText:

git-svn-id: http://macvim.googlecode.com/svn/trunk@150 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
Bjorn Winckler
2007-08-17 09:11:31 +00:00
parent b3ff443cd4
commit e4813adad0
+11 -12
View File
@@ -57,20 +57,19 @@
// modifiers are already included and should not be added to the input
// buffer using CSI, K_MODIFIER).
//NSLog(@"%s%@ (%x)", _cmd, string, [string characterAtIndex:0]);
NSEvent *event = [NSApp currentEvent];
if ([event type] == NSKeyDown) {
unsigned mods = [event modifierFlags];
unichar c = [[event charactersIgnoringModifiers] characterAtIndex:0];
//NSLog(@"%s%@ (event=%@)", _cmd, string, event);
if (mods & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask)
&& ' ' == c) {
// HACK! In order to be able to bind to <S-Space> etc. we have to
// watch for when space was pressed.
[self dispatchKeyEvent:event];
return;
}
// HACK! In order to be able to bind to <S-Space> etc. we have to watch
// for when space was pressed.
if ([event type] == NSKeyDown
&& [[event charactersIgnoringModifiers] length] > 0
&& [[event charactersIgnoringModifiers] characterAtIndex:0] == ' '
&& [event modifierFlags]
& (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask))
{
[self dispatchKeyEvent:event];
return;
}
[NSCursor setHiddenUntilMouseMoves:YES];