aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-12-31 12:29:50 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-12-31 13:20:12 +0100
commitbfdc1dd7feafc282124104d33730898c25402a14 (patch)
tree0b937f1466c659f9dc58bf155e41faf48f1b6b84 /text.c
parenteb8a8c5fa0657d8a3d404589d6ad1f954acde935 (diff)
downloadvis-bfdc1dd7feafc282124104d33730898c25402a14.tar.gz
vis-bfdc1dd7feafc282124104d33730898c25402a14.tar.xz
text: let text_pos_by_lineno return EPOS if given a too large line number
Diffstat (limited to 'text.c')
-rw-r--r--text.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/text.c b/text.c
index 7f94247..bf597da 100644
--- a/text.c
+++ b/text.c
@@ -1517,7 +1517,7 @@ size_t text_pos_by_lineno(Text *txt, size_t lineno) {
cache->pos = lines_skip_forward(txt, 0, lineno - 1, &lines_skipped);
cache->lineno = lines_skipped + 1;
}
- return cache->pos;
+ return cache->lineno == lineno ? cache->pos : EPOS;
}
size_t text_lineno_by_pos(Text *txt, size_t pos) {