From db7a6684a1212f8a900b1a07bb2e9c4c87cd9586 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 12 Sep 2015 23:00:15 -0700 Subject: linenoise: Suppress unknown control characters. * linenoise/linenoise.c (edit): Don't let characters less than 32 be inserted. * txr.1: Documented that control characters are rejected. --- linenoise/linenoise.c | 2 ++ txr.1 | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 47d1754e..ffbd38e4 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1030,6 +1030,8 @@ static int edit(lino_t *l, const char *prompt) } break; default: + if (c < 32) + break; if (edit_insert(l,c)) { l->error = lino_ioerr; return -1; diff --git a/txr.1 b/txr.1 index 3647102f..7edd2e0e 100644 --- a/txr.1 +++ b/txr.1 @@ -33245,11 +33245,13 @@ recall. .SS* Basic Operation -The interactive listener prints a numbered prompt, and then accepts input -characters from the terminal. Characters are either interpreted as editing -commands or other special characters, or else are inserted into the -editing buffer. The number in the prompt increments with every command. -The first command line is numbered 1, the second one 2 and so forth. +The interactive listener prints a numbered prompt. The number in the prompt increments with every +command. The first command line is numbered 1, the second one 2 and so forth. + +The listener accepts input characters from the terminal. Characters are either +interpreted as editing commands or other special characters, or else are +inserted into the editing buffer. However, control characters which don't +correspond to commands are silently rejected. The carriage return character generated by the Enter key indicates that a complete line has been entered, and it is to be interpreted. The listener -- cgit v1.2.3