]> git.lyx.org Git - features.git/commitdiff
Do not insert non-rpintable characters (such as ASCII control characters)
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 5 May 2015 12:23:24 +0000 (14:23 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 5 May 2015 12:23:24 +0000 (14:23 +0200)
Fixes: #5704.
src/frontends/qt4/GuiApplication.cpp

index 4822e59967c132c63fa4f218c0721f6347d0f8d2..160df4a114d31fbbab41e73262a6850a36aed1b2 100644 (file)
@@ -69,6 +69,7 @@
 #include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/lyxalgo.h" // sorted
+#include "support/textutils.h"
 #include "support/Messages.h"
 #include "support/os.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
                // by a binding
                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.");
                        func = FuncRequest(LFUN_SELF_INSERT,
                                           FuncRequest::KEYBOARD);