From b3fb1e437f84138e5d6e8d9f6adbfce303b3a792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 11 Nov 2016 14:32:39 +0100 Subject: sam: fix range for line zero :0 < echo "Should be inserted at the start of the file" :1 < echo "Should replace the first line" --- sam.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sam.c') diff --git a/sam.c b/sam.c index 5ebf71c..2459fa5 100644 --- 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); } -- cgit v1.2.3