scroll

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

commit 67123e8c1c0aa873367388463fb69176f1581295
parent 848b32408da9e65c1b3c8062c2432390ea4d16f9
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Sat,  8 Feb 2020 11:05:23 +0100

add some comments to scrollup

Diffstat:
MMakefile | 2+-
Mscroll.c | 3+++
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -1,4 +1,4 @@ -CFLAGS += -std=c99 -pedantic -Wall -Wextra +CFLAGS += -std=c99 -pedantic -Wall -Wextra -g LDLIBS += -lutil CPPFLAGS += -D_DEFAULT_SOURCE diff --git a/scroll.c b/scroll.c @@ -173,12 +173,15 @@ scrollup(void) /* set cursor position */ write(STDOUT_FILENO, "\033[0;0H", 6); + /* check if the input line is on the bottom of the screen */ if (TAILQ_FIRST(&head) == bottom) first = 1; + /* wind back bottom pointer by two pages */ for (rows = 0; bottom != NULL && rows < 2 * ws.ws_row; rows++) bottom = TAILQ_NEXT(bottom, entries); + /* print one page */ for (; rows > ws.ws_row - first;) { if ((bottom = TAILQ_PREV(bottom, tailhead, entries)) == NULL) break;