Do not insert non-rpintable characters (such as ASCII control characters)

Fixes: #5704.
This commit is contained in:
Juergen Spitzmueller 2015-05-05 14:23:24 +02:00
parent 9e105996d6
commit 4ba17c90a0

View File

@ -69,6 +69,7 @@
#include "support/lassert.h" #include "support/lassert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/lyxalgo.h" // sorted #include "support/lyxalgo.h" // sorted
#include "support/textutils.h"
#include "support/Messages.h" #include "support/Messages.h"
#include "support/os.h" #include "support/os.h"
#include "support/Package.h" #include "support/Package.h"
@ -2131,6 +2132,12 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state)
// if it's normal insertable text not already covered // if it's normal insertable text not already covered
// by a binding // by a binding
if (keysym.isText() && d->keyseq.length() == 1) { if (keysym.isText() && d->keyseq.length() == 1) {
// Non-printable characters (such as ASCII control characters)
// must not be inserted (#5704)
if (!isPrintable(encoded_last_key)) {
LYXERR(Debug::KEY, "Non-printable character! Omitting.");
return;
}
LYXERR(Debug::KEY, "isText() is true, inserting."); LYXERR(Debug::KEY, "isText() is true, inserting.");
func = FuncRequest(LFUN_SELF_INSERT, func = FuncRequest(LFUN_SELF_INSERT,
FuncRequest::KEYBOARD); FuncRequest::KEYBOARD);