clamp height value in getsidebarsizedefault() - sfeed_curses - sfeed curses UI (now part of sfeed, development is in sfeed)
 (HTM) git clone git://git.codemadness.org/sfeed_curses
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 47e37f53d05797b18d2c6d2567187c28ac3f23ab
 (DIR) parent 542d8132811f4c139b40613a331ad049ccffb0d7
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon, 29 Mar 2021 19:31:13 +0200
       
       clamp height value in getsidebarsizedefault()
       
       This fixes an case in the horizontal layout mode when there are no new items
       and only new feeds are shown (using the 't' keybind). The height would be shown
       as 1, but internally the sidebar height is set to 0 and it would then require 2
       '>' keypresses to increase it from 1 to 2 height.
       
       A similar issue was in commit:
       7d9d4d493a90bbd56bbe5cf175970a32ecb915bd
       
       The ranges are checked in adjustsidebarsize() already so remove clamping there.
       
       Diffstat:
         M sfeed_curses.c                      |       6 +++---
       
       1 file changed, 3 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/sfeed_curses.c b/sfeed_curses.c
       @@ -1532,7 +1532,7 @@ getsidebarsizedefault(void)
                                if (onlynew && feed->totalnew == 0)
                                        continue;
                        }
       -                return MIN(win.width - 1, size);
       +                return MAX(MIN(win.width - 1, size), 0);
                case LayoutHorizontal:
                        for (i = 0, size = 0; i < nfeeds; i++) {
                                feed = &feeds[i];
       @@ -1540,7 +1540,7 @@ getsidebarsizedefault(void)
                                        continue;
                                size++;
                        }
       -                return MIN((win.height - 1) / 2, size);
       +                return MAX(MIN((win.height - 1) / 2, size), 1);
                }
                return 0;
        }
       @@ -1552,7 +1552,7 @@ getsidebarsize(void)
        
                if ((size = fixedsidebarsizes[layout]) < 0)
                        size = getsidebarsizedefault();
       -        return MAX(size, layout == LayoutHorizontal ? 1 : 0);
       +        return size;
        }
        
        void