vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 4389009dfc943cb140f373cc64d94a9d243da72b
parent 8514310fd7cd6a7c6043323f4cb0931fcf8fa208
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 29 Dec 2015 08:57:45 +0100

view: improve cursor handling at end of file

Holding down <Backspace> at the end of the file should not
keep the cursor on the middle line of the window.

Diffstat:
Mview.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/view.c b/view.c @@ -1137,7 +1137,7 @@ void view_cursors_to(Cursor *c, size_t pos) { c->mark = text_mark_set(view->text, pos); size_t max = text_size(view->text); - if (pos == max && view->end != max) { + if (pos == max && view->end < max) { /* do not display an empty screen when shoviewg the end of the file */ view->start = pos; view_viewport_up(view, view->height / 2);