commit 3a664c24cc4008ef1dea102c8d82f5f149e154e4
parent e2c6a3b05ac5feed7250188d8852e8a7d4ab81a6
Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Tue, 31 Mar 2020 21:26:21 +0200
Actually jump down on new input
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/scroll.c b/scroll.c
@@ -296,6 +296,18 @@ scrolldown(char *buf, size_t size)
}
}
+void
+jumpdown(char *buf, size_t size)
+{
+ int rows = ws.ws_row;
+
+ bottom = TAILQ_FIRST(&head);
+ for (; TAILQ_NEXT(bottom, entries) != NULL && rows > 0; rows--)
+ bottom = TAILQ_NEXT(bottom, entries);
+
+ scrolldown(buf, size);
+}
+
int
main(int argc, char *argv[])
{
@@ -375,8 +387,7 @@ main(int argc, char *argv[])
else if (write(mfd, &c, 1) == -1)
die("write:");
else if (bottom != TAILQ_FIRST(&head)) {
- bottom = TAILQ_FIRST(&head);
- scrolldown(buf, pos);
+ jumpdown(buf, pos);
}
}
if (pfd[1].revents & POLLIN) {