summaryrefslogtreecommitdiffstats
path: root/linenoise
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-11 06:41:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-11 06:41:08 -0700
commit077d813e87f69543ad695e88d1958e12e059a94f (patch)
treed42a63b783d2dd7cec4a77e64b70dcc6c1d35253 /linenoise
parent5e032b9b6a2dc023fc9a00006877b4233c301401 (diff)
downloadtxr-077d813e87f69543ad695e88d1958e12e059a94f.tar.gz
txr-077d813e87f69543ad695e88d1958e12e059a94f.tar.bz2
txr-077d813e87f69543ad695e88d1958e12e059a94f.zip
linenoise: Ctrl-C cleanly cancels completion.
* linenoise/linenoise.c (complete_line): If Ctrl-C is pressed in completion mode, we cancel completion and return 0 so the command loop reads a new character. * txr.1: Documented Ctrl-C in completion mode, and removed the falsehood that ESC is a cancel command, adding instead an explanation about the ESC handling is really for.
Diffstat (limited to 'linenoise')
-rw-r--r--linenoise/linenoise.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index 0622d258..404cf284 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -337,6 +337,9 @@ static int complete_line(lino_t *ls) {
i = (i+1) % (lc.len+1);
if (i == lc.len) generate_beep(ls);
break;
+ case CTL('C'):
+ c = 0;
+ /* fallthrough */
case ESC:
/* Re-show original buffer */
if (i < lc.len) refresh_line(ls);