Skip to content

Commit

Permalink
check for EOF before unsetting row, col & line cache in view_coord_get
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybobbin committed Mar 27, 2023
1 parent c9737a7 commit d1c068b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d1c068b

Please sign in to comment.