[hackers] [scroll] Fix setting bottom pointer while scrolling || Jochen Sprickerhof

From: <git_AT_suckless.org>
Date: Thu, 23 Apr 2020 22:40:47 +0200 (CEST)

commit 68e4cf9bea15e2ac33224f8b96d7f5ff58ac6e77
Author: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
AuthorDate: Thu Apr 23 22:26:28 2020 +0200
Commit: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
CommitDate: Thu Apr 23 22:26:28 2020 +0200

    Fix setting bottom pointer while scrolling

diff --git a/scroll.c b/scroll.c
index 5b09893..f8de6c0 100644
--- a/scroll.c
+++ b/scroll.c
_AT_@ -246,8 +246,6 @@ addline(char *buf, size_t size)
         line->buf = earealloc(NULL, size);
         memcpy(line->buf, buf, size);
 
- bottom = line;
-
         TAILQ_INSERT_HEAD(&head, line, entries);
 }
 
_AT_@ -536,6 +534,13 @@ main(int argc, char *argv[])
 
                                 if (*c == '\n') {
                                         addline(buf, pos);
+ /* only advance bottom if scroll is */
+ /* at the end of the scroll back */
+ if (bottom == NULL ||
+ TAILQ_PREV(bottom, tailhead,
+ entries) == TAILQ_FIRST(&head))
+ bottom = TAILQ_FIRST(&head);
+
                                         memset(buf, 0, size);
                                         pos = 0;
                                 }
Received on Thu Apr 23 2020 - 22:40:47 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 23 2020 - 22:48:37 CEST