vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 35f4cc31685e478fcaacde5565c18fa9d498b99c parent b4f3013ba9e6f361f79868e4b41152bb4d408664 Author: Marc André Tanner <mat@brain-dump.org> Date: Fri, 11 Nov 2016 14:32:39 +0100 sam: fix range for line zero :0 < echo "Should be inserted at the start of the file" :1 < echo "Should replace the first line" Diffstat:
| M | sam.c | | | 2 | ++ |
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/sam.c b/sam.c @@ -731,6 +731,8 @@ static Filerange address_line_evaluate(Address *addr, File *file, Filerange *ran line = text_lineno_by_pos(txt, start); line = offset < line ? text_pos_by_lineno(txt, line - offset) : 0; } else { + if (addr->number == 0) + return text_range_new(0, 0); line = text_pos_by_lineno(txt, addr->number); }