Simplify window fraction logic - scroll - scrollbackbuffer program for st
 (HTM) git clone git://git.suckless.org/scroll
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 66f97243ff888b8cdcd69b57d3abdaf58a070ec9
 (DIR) parent 4ed0bd4aa3382ec3b73693b4379cfa8cc91e0e7e
 (HTM) Author: Jochen Sprickerhof <git@jochen.sprickerhof.de>
       Date:   Sun, 12 Apr 2020 22:53:03 +0200
       
       Simplify window fraction logic
       
       Diffstat:
         M scroll.c                            |       8 ++++----
       
       1 file changed, 4 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/scroll.c b/scroll.c
       @@ -296,8 +296,8 @@ scrollup(int n)
                int rows = 2;
                struct line *scrollend = bottom;
        
       -        if (n < 0)
       -                n = ws.ws_row / (-n) > 0 ? ws.ws_row / (-n) : 1;
       +        if (n < 0) /* scroll by fraction of window rows, but at least one line */
       +                n = ws.ws_row > (-n) ? ws.ws_row / (-n) : 1;
        
                /* wind back scrollend pointer by one page plus n */
                for (; scrollend != NULL && TAILQ_NEXT(scrollend, entries) != NULL &&
       @@ -338,8 +338,8 @@ scrolldown(char *buf, size_t size, int n)
                if (bottom == NULL || bottom == TAILQ_FIRST(&head))
                        return;
        
       -        if (n < 0)
       -                n = ws.ws_row / (-n) > 0 ? ws.ws_row / (-n) : 1;
       +        if (n < 0) /* scroll by fraction of window rows, but at least one line */
       +                n = ws.ws_row > (-n) ? ws.ws_row / (-n) : 1;
        
                bottom = TAILQ_PREV(bottom, tailhead, entries);
                /* print n lines */