scroll

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

commit 0ae52bc1bc31481966cc21e0b540b76ed9d61a2e
parent 7d747070288a92a10c54e6e1101ea1cceac43f05
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date:   Mon, 17 Feb 2020 20:28:09 +0100

Simplify if

Diffstat:
Mscroll.c | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/scroll.c b/scroll.c @@ -185,11 +185,8 @@ scrollup(void) write(STDOUT_FILENO, "\033[?25l", 6); /* print one page */ - for (; rows > ws.ws_row; rows--) { - if (TAILQ_PREV(bottom, tailhead, entries) == NULL) - break; + for (; rows > ws.ws_row && TAILQ_PREV(bottom, tailhead, entries) != NULL; rows--) { bottom = TAILQ_PREV(bottom, tailhead, entries); - write(STDOUT_FILENO, bottom->buf, bottom->size); } } @@ -200,11 +197,8 @@ scrolldown(void) int rows = ws.ws_row; /* print one page */ - for (; rows >= 0; rows--) { - if (TAILQ_PREV(bottom, tailhead, entries) == NULL) - break; + for (; rows >= 0 && TAILQ_PREV(bottom, tailhead, entries) != NULL; rows--) { bottom = TAILQ_PREV(bottom, tailhead, entries); - write(STDOUT_FILENO, bottom->buf, bottom->size); } }