vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 6b5f9c7ba7c1b9d505b016d79cec0b751910af15 parent 38dd83a5af299b87d03f77f03e1fcc606c711853 Author: Jeremy Bobbin <jer@jer.cx> Date: Mon, 27 Mar 2023 11:28:56 -0700 check for EOF before unsetting row, col & line cache in view_coord_get This commit fixes b6647ad, which introduced a bug when the EOF was in view. Diffstat:
| M | view.c | | | 3 | ++- |
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/view.c b/view.c @@ -283,7 +283,8 @@ bool view_coord_get(View *view, size_t pos, Line **retline, int *retrow, int *re size_t cur = view->start; Line *line = view->topline; - if (pos < view->start || pos >= view->end) { + bool eof = view->end == text_size(view->text); + if (pos < view->start || (pos >= view->end && !eof)) { if (retline) *retline = NULL; if (retrow) *retrow = -1; if (retcol) *retcol = -1;