| Date: Fri, 17 Apr 2020 22:47:19 +0200
Only move bottom if it was scrolled out of the window
Diffstat:
M scroll.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--- |
| @@ -314,16 +314,22 @@ scrollup(int n)
write(STDOUT_FILENO, scrollend->buf + 1, scrollend->size - 1);
else
write(STDOUT_FILENO, scrollend->buf, scrollend->size);
- bottom = TAILQ_NEXT(bottom, entries);
+ if ( x + n >= ws.ws_row)
+ bottom = TAILQ_NEXT(bottom, entries);
/* print rows lines and move bottom forward to the new screen bottom */
for (; rows > 1; rows--) {
scrollend = TAILQ_PREV(scrollend, tailhead, entries);
- bottom = TAILQ_NEXT(bottom, entries);
+ if ( x + n >= ws.ws_row)
+ bottom = TAILQ_NEXT(bottom, entries);
write(STDOUT_FILENO, scrollend->buf, scrollend->size);
}
/* move cursor from line n to the old bottom position */
- dprintf(STDOUT_FILENO, "\033[%d;0H", x);
+ if (x + n < ws.ws_row) {
+ dprintf(STDOUT_FILENO, "\033[%d;%dH", x + n, y);
+ write(STDOUT_FILENO, "\033[?25h", 6); /* show cursor */
+ } else
+ dprintf(STDOUT_FILENO, "\033[%d;0H", ws.ws_row);
}
void |