vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit d4d318c05fcbc4a8e38b13b1f3dc191851ce7712 parent c78177cd563fa0c0a86fc1c56320f70684716aeb Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 5 Jun 2017 09:26:17 +0200 sam: fix + address Previoulsy + would not advance to the next line when the cursor was on the first character of a line. This should fix the +- idiom, i.e. :+-x/foo/c/bar/ performs a substitution on the current line. Diffstat:
| M | sam.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sam.c b/sam.c @@ -980,7 +980,7 @@ static Filerange address_line_evaluate(Address *addr, File *file, Filerange *ran size_t start = range->start, end = range->end, line; if (sign > 0) { char c; - if (end > 0 && text_byte_get(txt, end-1, &c) && c == '\n') + if (start < end && end > 0 && text_byte_get(txt, end-1, &c) && c == '\n') end--; line = text_lineno_by_pos(txt, end); line = text_pos_by_lineno(txt, line + offset);