summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-03-28 17:28:44 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-03-28 17:28:44 -0700
commitedd182e778e116f2c2c62fbc09102372b0c03500 (patch)
treef0efdfc0af2fd9d7f2fab10be2eecafebea69736
parent6e916b2f987a5340fe1e0f0ff70e2bde533a793b (diff)
downloadtxr-edd182e778e116f2c2c62fbc09102372b0c03500.tar.gz
txr-edd182e778e116f2c2c62fbc09102372b0c03500.tar.bz2
txr-edd182e778e116f2c2c62fbc09102372b0c03500.zip
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.
-rw-r--r--linenoise/linenoise.c6
-rw-r--r--txr.110
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