vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit f5ae70c9cc25653b7432d102c5ca164e9e98e381 parent 0b26b2c3efb86da0877dc9ec98e7bc327c113dfd Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 25 Jan 2021 13:43:07 +0100 sam: produce empty match at the end of looped range In certain cases (e.g. involving negated character classes) the last empty match of an x command would wrongly be skipped. See #925 Diffstat:
| M | sam.c | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sam.c b/sam.c @@ -1417,6 +1417,7 @@ static int extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Selecti if (match[0].start == match[0].end) { if (last_start == match[0].start) { start++; + trailing_match = start == end; continue; } /* in Plan 9's regexp library ^ matches the beginning @@ -1429,8 +1430,7 @@ static int extract(Vis *vis, Win *win, Command *cmd, const char *argv[], Selecti break; } start = match[0].end; - if (start == end) - trailing_match = true; + trailing_match = start == end; } else { if (argv[0][0] == 'y') r = text_range_new(start, end);