Do not insert literally control keystrokes unless the default

GSInsertControlKeystrokes is YES.  NSBeep when a function or control key
is typed and is not bound to any action


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12851 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-02-27 21:06:29 +00:00
parent dbe88936d1
commit 7578f35464

View file

@ -28,6 +28,9 @@
#include <AppKit/NSInputServer.h>
#include <AppKit/NSText.h>
/* For NSBeep () */
#include <AppKit/NSApplication.h>
#include "GSKeyBindingAction.h"
#include "GSKeyBindingTable.h"
@ -366,6 +369,11 @@ static NSInputManager *currentInputManager = nil;
}
}
/* Read if we should insert Control- keystrokes into the text.
This defaults to NO. */
_insertControlKeystrokes = [defaults boolForKey:
@"GSInsertControlKeystrokes"];
/* Read the quote key from the user defaults. */
{
NSString *quoteKey = [defaults stringForKey: @"GSQuoteKey"];
@ -611,9 +619,21 @@ static NSInputManager *currentInputManager = nil;
Trying to insert 'PageUp' literally makes simply no sense. */
if (isFunctionKey)
{
NSBeep ();
break;
}
/* During literal interpretation, control characters are ignored
if GSInsertControlKeystrokes was NO. */
if (_insertControlKeystrokes == NO)
{
if (flags & NSControlKeyMask)
{
NSBeep ();
break;
}
}
switch (character)
{
case NSBackspaceCharacter:
@ -641,7 +661,7 @@ static NSInputManager *currentInputManager = nil;
[self insertText: characters];
break;
}
}
}
}
- (void) resetInternalState