Skip to content

Commit

Permalink
text: let text_pos_by_lineno return EPOS if given a too large line nu…
Browse files Browse the repository at this point in the history
…mber
  • Loading branch information
martanne committed Dec 31, 2015
1 parent eb8a8c5 commit bfdc1dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion text.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bfdc1dd

Please sign in to comment.