From b6f287938aecc060e8651dba8c77909616ff245b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 31 Oct 2015 14:26:33 +0100 Subject: view: make zb command more robust The new approach first scrolls the window up such that the current cursor line lies below the current visible area, then the viewport is adjusted until the line is once again visible (at the bottom of the window). Closes #85 --- view.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/view.c b/view.c index e7f9d4d..0491c78 100644 --- a/view.c +++ b/view.c @@ -707,11 +707,9 @@ void view_redraw_bottom(View *view) { Line *line = view->cursor->line; if (line == view->lastline) return; - int linenr = 0; size_t pos = view->cursor->pos; - for (Line *cur = view->topline; cur && cur != line; cur = cur->next) - linenr++; - view_slide_down(view, view->height - linenr - 1); + view_viewport_up(view, view->height); + while (pos > view->end && view_viewport_down(view, 1)); view_cursor_to(view, pos); } -- cgit v1.2.3