diff options
-rw-r--r-- | linenoise/linenoise.c | 4 | ||||
-rw-r--r-- | txr.1 | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 7dd29aa5..1a16ac7c 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1118,6 +1118,9 @@ static void paren_jump(lino_t *l) { size_t pos = scan_rev(l->data, l->dpos - 1); + if (pos == -1) + pos = scan_fwd(l->data, l->dpos - 1); + if (pos != -1) { size_t dp = l->dpos; l->dpos = pos; @@ -1840,6 +1843,7 @@ static int edit(lino_t *l, const char *prompt) } break; case ')': case ']': case '}': + case '(': case '[': case '{': if (edit_insert(l,c)) { l->error = lino_ioerr; goto out; @@ -34126,12 +34126,20 @@ When any of the three closing characters or .code } is inserted, the listener scans backward for the matching opening -character. If the matching character is found, the cursor jumps to that +character. Likewise, if any of the three opening characters +.codn ( , +.codn [ +or +.code { +is inserted in the middle of text, the listener scans forward for the matching +closing character. + +If the matching character is found, the cursor jumps to that character and then returns to the original position a brief moment later. If a new character is typed during the brief time delay, the delay is immediately canceled, so as not to hinder rapid typing. -Note that the backward matching is unsophisticated; it doesn't observe the +Note that the matching is unsophisticated; it doesn't observe the lexical conventions and syntax of the \*(TL programming language. For instance, a closing parenthesis outside a string literal may match match an opening one inside a string literal. |