vis

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

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

commit 1382395e18e7cdb29f1eaf6a4086af32cc1d39f2
parent 890cc1f5dd84c6e97c0c3668d4f09454698b741a
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 29 Apr 2016 16:21:37 +0200

view: improve view sliding down

Close #216

Diffstat:
Mview.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/view.c b/view.c @@ -897,9 +897,11 @@ size_t view_slide_up(View *view, int lines) { size_t view_slide_down(View *view, int lines) { Cursor *cursor = view->cursor; + bool lastline = cursor->line == view->lastline; + size_t col = cursor->col; if (view_viewport_up(view, lines)) { - if (cursor->line == view->lastline) - cursor_set(cursor, view->lastline, cursor->col); + if (lastline) + cursor_set(cursor, view->lastline, col); else view_cursor_to(view, cursor->pos); } else {