From edd182e778e116f2c2c62fbc09102372b0c03500 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 28 Mar 2020 17:28:44 -0700 Subject: linenoise: command to force submission of unbalanced line. * linenoise.c (edit): Handle Ctrl-F in extended mode so that Ctrl-X Ctrl-F forces the line to be submitted without a balance check. * txr.1: Document previously undocumented balance check, including the flashing exclamation mark. Document Ctrl-X Ctrl-F. --- linenoise/linenoise.c | 6 ++++-- txr.1 | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index e61ba49d..78a3446f 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -2212,12 +2212,14 @@ static int edit(lino_t *l, const wchar_t *prompt) } break; } + /* fallthrough */ + l->save_hist_idx = l->history_index; + case CTL('F'): + ret = l->len; if (l->mlmode) edit_move_end(l); if (l->need_refresh) refresh_line(l); - ret = l->len; - l->save_hist_idx = l->history_index; goto out; case '?': extended = 0; diff --git a/txr.1 b/txr.1 index c7cf620d..72466bf5 100644 --- a/txr.1 +++ b/txr.1 @@ -71427,6 +71427,16 @@ such a line .B is entered into the history. +The listener does not allow lines containing certain bad syntax to be submitted +with Enter. If the buffer contains an expression with unbalanced parentheses +or brackets, or unterminated literals, then Enter generates a newline character +which is inserted into the buffer. In that situation, if that newline character +is being added at the very end of the buffer, the listener flashes the +exclamation mark character (!) two times to warn the user that line has not +been submitted: no computation is taking place, and the listener is waiting for +more input. It is possible to force the submission of an unbalanced line using +the sequence Ctrl-X, Ctrl-F. + .SS* Limitations The interactive listener can only accept up to 4095 abstract characters of -- cgit v1.2.3