scroll

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

commit deee4c0f1c3838292f45a835dd051048781de234
parent 301473795e1eb79511fb814674312d43e2286059
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date:   Tue, 18 Feb 2020 07:28:01 +0100

Simplify scrollback logic

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

diff --git a/scroll.c b/scroll.c @@ -207,12 +207,10 @@ scrollup(void) int rows = 0; /* wind back bottom pointer by two pages */ - for (rows = 0; bottom != NULL && rows < 2 * ws.ws_row; rows++) + for (; TAILQ_NEXT(bottom, entries) != NULL && rows < 2 * ws.ws_row; rows++) bottom = TAILQ_NEXT(bottom, entries); - if (bottom == NULL) - bottom = TAILQ_LAST(&head, tailhead); - if (rows - ws.ws_row < 0) { + if (rows < ws.ws_row) { bottom = TAILQ_FIRST(&head); return; }