Skip to content

Commit

Permalink
view: make cursor placement more robust
Browse files Browse the repository at this point in the history
Reject invalid cursor positions.
  • Loading branch information
martanne committed Dec 5, 2016
1 parent 05f0364 commit 6e2bfdc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,11 @@ void view_cursors_scroll_to(Cursor *c, size_t pos) {

void view_cursors_to(Cursor *c, size_t pos) {
View *view = c->view;
if (pos == EPOS)
return;
size_t size = text_size(view->text);
if (pos > size)
pos = size;
if (c->view->cursor == c) {
/* make sure we redraw changes to the very first character of the window */
if (view->start == pos)
Expand Down

0 comments on commit 6e2bfdc

Please sign in to comment.