vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 24965fe25cec393b1a034d844e233a3fdc5f0a54
parent 4fb1c844a988e9be6091bd60efccefa539d64093
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 15 Dec 2016 11:52:14 +0100

vis: respect terminating NUL bytes in the input queue

It can happen that the Buffer content used for the input queue becomes
<\000> where the NUL byte is intended to terminate the queue, but termkey
happily parses it and because it is delimited by < and > on both sides
we then interpret it as a key. In input mode this leads to the insertion
of a NUL byte which is displayed as ^@.

Close #432

Diffstat:
Mvis.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vis.c b/vis.c @@ -844,7 +844,7 @@ const char *vis_keys_next(Vis *vis, const char *keys) { TermKey *termkey = vis->ui->termkey_get(vis->ui); const char *next = NULL; /* first try to parse a special key of the form <Key> */ - if (*keys == '<' && (next = termkey_strpkey(termkey, keys+1, &key, TERMKEY_FORMAT_VIM)) && *next == '>') + if (*keys == '<' && keys[1] && (next = termkey_strpkey(termkey, keys+1, &key, TERMKEY_FORMAT_VIM)) && *next == '>') return next+1; if (*keys == '<') { const char *start = keys + 1, *end = start;