From 1bdd343418bdf65f8c7aa95ed21d6d0fe4730237 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 12 Sep 2015 23:39:28 -0700 Subject: linenoise: incorrect ESC treatment in completion. * linenoise/linenoise.c (complete_line): ESC must not be treated specially when leaving completion mode; it must accept the completed line. The original code did this wrong in my opinion and I propagated the error. * txr.1: Remove all mention of special ESC treatment in completion mode. --- linenoise/linenoise.c | 4 +--- txr.1 | 13 +------------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index ffbd38e4..0ea057ab 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -338,12 +338,10 @@ static int complete_line(lino_t *ls) { 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); stop = 1; + c = 0; break; default: /* Update buffer and return */ diff --git a/txr.1 b/txr.1 index 7edd2e0e..c7cf6171 100644 --- a/txr.1 +++ b/txr.1 @@ -33624,21 +33624,10 @@ in. The other completions may be viewed one by one using the Tab key. When the completions are exhausted, the original uncompleted line is shown again, and Tab can continue to be used to cycle through the completions again. In completion mode, the Ctrl-C character acts as a command to cancel completion mode -and return to editing the original uncompleted line. The ESC character -similarly cancels completion, restoring the original line, but unlike Ctrl-C, -it is then processed in regular editing mode. Any other input character causes +and return to editing the original uncompleted line. Any other input character causes the listener to keep the currently shown completion, and return to edit mode, where that that character is processed again as a command. -Note: the peculiar behavior for the ESC character in completion mode is -intended to handles situations in which an arrow key is used while in -completion mode. When any arrow key is pressed, the line is restored and then -the arrow key is processed in ordinary mode (translating to an editing -movement or history navigation). The connection between ESC and arrow keys -is that arrow keys (and other special command keys) are represented, by a -VT100-compatible terminal or terminal emulator, as special sequences of -bytes beginning with ESC (known as "escape sequences"). - .SS* Reading Forms Directly from the Terminal The listener is currently line oriented. There is, however, support for -- cgit v1.2.3