aboutsummaryrefslogtreecommitdiff
path: root/sam.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-11 14:32:39 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-11 14:32:39 +0100
commitb3fb1e437f84138e5d6e8d9f6adbfce303b3a792 (patch)
tree60d437208e2ea50b698006f1a6e45c3f977322b7 /sam.c
parent2fa455de8c7907b738b0c481894e704f5ebf32db (diff)
downloadvis-b3fb1e437f84138e5d6e8d9f6adbfce303b3a792.tar.gz
vis-b3fb1e437f84138e5d6e8d9f6adbfce303b3a792.tar.xz
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 (limited to 'sam.c')
-rw-r--r--sam.c2
1 files changed, 2 insertions, 0 deletions
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);
}