]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
avoid overlapping backtitle in whiptail
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 24 Nov 2022 15:01:51 +0000 (16:01 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 24 Nov 2022 16:21:29 +0000 (17:21 +0100)
If using automatic height or width, decrease the height by one if the
backtitle would overlap the window.

whiptail.c

index 0dd60a71dcac4f10904ac3c0cb59c6f2d5b4141f..03a9c9bac3eb2519d4386f5afa1c61ff368e5c68 100644 (file)
@@ -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;