scroll

scrollbackbuffer program for st
git clone git://git.suckless.org//gitrepos
Log | Files | Refs

commit 7e05ee78525d93fb4b3aed2dd5f7ec53f19b8a57
parent a7570270a8bce8657013bb0fbb97455fc0627ffa
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Tue, 11 Feb 2020 21:13:12 +0100

prevent bottom from getting NULL again in scrolldown

Diffstat:
Mscroll.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scroll.c b/scroll.c @@ -208,8 +208,11 @@ scrolldown(void) write(STDOUT_FILENO, "\r\n", 2); /* print one page */ for (; rows >= 0;) { - if ((bottom = TAILQ_PREV(bottom, tailhead, entries)) == NULL) + if (TAILQ_PREV(bottom, tailhead, entries) != NULL) + bottom = TAILQ_PREV(bottom, tailhead, entries); + else break; + if (--rows > 0) write(STDOUT_FILENO, bottom->buf, bottom->size); else /* last line w/o "/r/n" */