]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
check for zero menu/list height in whiptail
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 24 Nov 2022 13:50:04 +0000 (14:50 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 24 Nov 2022 16:21:26 +0000 (17:21 +0100)
When the specified window height and width are larger than zero, but the
menu/list height is zero, calculate all three values to fit the
specified entries.

whiptail.c

index 773793a795412b16eff1692f4d828f796180832b..0dd60a71dcac4f10904ac3c0cb59c6f2d5b4141f 100644 (file)
@@ -328,7 +328,7 @@ int main(int argc, const char ** argv) {
     char * end;
     int height;
     int width;
-    int listHeight = 0;
+    int listHeight = 1;
     int fd = -1;
     int needSpace = 0;
     int noCancel = 0;
@@ -523,7 +523,7 @@ int main(int argc, const char ** argv) {
 
     cleanNewlines(text);
 
-    if ( height <= 0 || width <= 0 )
+    if (height <= 0 || width <= 0 || listHeight <= 0)
        guessSize(&height, &width, &listHeight, mode, &flags, fullButtons,
                 title, text, optCon);