aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'view.c')
-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 {