diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-10-31 14:26:33 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-10-31 14:26:33 +0100 |
| commit | b6f287938aecc060e8651dba8c77909616ff245b (patch) | |
| tree | 856f436f91970ddb4931bf455801dfaf1e214743 | |
| parent | 3cbea071e181cd3fa1bd77be0ec586cf41735e60 (diff) | |
| download | vis-b6f287938aecc060e8651dba8c77909616ff245b.tar.gz vis-b6f287938aecc060e8651dba8c77909616ff245b.tar.xz | |
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
| -rw-r--r-- | view.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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); } |
