From: Miroslav Lichvar Date: Thu, 24 Nov 2022 15:01:51 +0000 (+0100) Subject: avoid overlapping backtitle in whiptail X-Git-Tag: r0-52-23~6 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=73bb4086e366fd5375556244bf154ca4c316a11d;p=thirdparty%2Fnewt.git avoid overlapping backtitle in whiptail If using automatic height or width, decrease the height by one if the backtitle would overlap the window. --- diff --git a/whiptail.c b/whiptail.c index 0dd60a7..03a9c9b 100644 --- a/whiptail.c +++ b/whiptail.c @@ -523,9 +523,16 @@ int main(int argc, const char ** argv) { cleanNewlines(text); - if (height <= 0 || width <= 0 || listHeight <= 0) + if (height <= 0 || width <= 0 || listHeight <= 0) { guessSize(&height, &width, &listHeight, mode, &flags, fullButtons, title, text, optCon); + if (!topLeft && backtitle && SLtt_Screen_Rows > 10 && + height + 1 == SLtt_Screen_Rows && + _newt_wstrlen(backtitle, -1) > (SLtt_Screen_Cols - width) / 2) { + height -= 1; + listHeight -= 1; + } + } width -= 2; height -= 2;