summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-12 23:00:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-12 23:00:15 -0700
commitdb7a6684a1212f8a900b1a07bb2e9c4c87cd9586 (patch)
tree2e895cf258e7ad9a7a8d9e35ac4ca7b85f6fbc0a
parentd3868fc92143ff9506606830b16c47051e4ea1e4 (diff)
downloadtxr-db7a6684a1212f8a900b1a07bb2e9c4c87cd9586.tar.gz
txr-db7a6684a1212f8a900b1a07bb2e9c4c87cd9586.tar.bz2
txr-db7a6684a1212f8a900b1a07bb2e9c4c87cd9586.zip
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.
-rw-r--r--linenoise/linenoise.c2
-rw-r--r--txr.112
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