From bb5f279ba38444fe2dd0b25f45269642ef0401eb Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 24 Nov 2022 14:50:04 +0100 Subject: [PATCH] check for zero menu/list height in whiptail 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whiptail.c b/whiptail.c index 773793a..0dd60a7 100644 --- a/whiptail.c +++ b/whiptail.c @@ -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); -- 2.47.3