vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 257d5b9786fa999c969f565b0ee17311cfaefbe7 parent 101c0e1ef804eae9729be41192f7c2e01c17e1b4 Author: Marc André Tanner <mat@brain-dump.org> Date: Thu, 31 Dec 2015 12:29:50 +0100 text: let text_pos_by_lineno return EPOS if given a too large line number Diffstat:
| M | text.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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) {