commit 7cc66224c3244a8a0c6e18f45730dead23768056
parent 34ac4273c07f54ed3dbc9c9ba5aae833a4c52f1c
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Tue, 31 Mar 2020 20:00:52 +0200
Don't scroll over one line upon first scrollup
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/scroll.c b/scroll.c
@@ -245,7 +245,11 @@ addline(char *buf, size_t size)
void
scrollup(void)
{
- int rows = 0;
+ int rows = 0, start = 0;
+
+ /* account for last line */
+ if(TAILQ_PREV(bottom, tailhead, entries) == NULL)
+ start = 1;
/* wind back bottom pointer by two pages */
for (; bottom != NULL && TAILQ_NEXT(bottom, entries) != NULL && rows < 2 * ws.ws_row; rows++)
@@ -264,7 +268,7 @@ scrollup(void)
write(STDOUT_FILENO, "\033[?25l", 6);
/* print one page */
- for (rows = 0; rows < ws.ws_row; rows++) {
+ for (rows = 0; rows < ws.ws_row + start; rows++) {
bottom = TAILQ_PREV(bottom, tailhead, entries);
write(STDOUT_FILENO, bottom->buf, bottom->size);
}