aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-29 16:21:37 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-29 16:21:37 +0200
commit9b68bc512d942c8e7a3625517f929bb7abaafb59 (patch)
treeab2559228d21cc6a9879d1d0a7e23c4cd090cc85
parent78ea0cd428d2349f11d3f1f4abd00218a4b0f152 (diff)
downloadvis-9b68bc512d942c8e7a3625517f929bb7abaafb59.tar.gz
vis-9b68bc512d942c8e7a3625517f929bb7abaafb59.tar.xz
view: improve view sliding down
Close #216
-rw-r--r--view.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/view.c b/view.c
index 47709ee..eb05df4 100644
--- 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 {