From b2ad856aac657e26a9117ea6662289575e6eb514 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 19 Jul 2024 01:47:43 +0100 Subject: [PATCH] bsddialog: Fix off-by-one in upstream's minibarlen calculation The text in the [...] is 14 characters long, but that includes the terminator that isn't rendered, so there are only 13 visible characters (plus the square brackets). --- contrib/bsddialog/lib/barbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/bsddialog/lib/barbox.c b/contrib/bsddialog/lib/barbox.c index 7db65644becd..b02ec31f86cd 100644 --- a/contrib/bsddialog/lib/barbox.c +++ b/contrib/bsddialog/lib/barbox.c @@ -229,7 +229,7 @@ do_mixedgauge(struct bsddialog_conf *conf, const char *text, int rows, int cols, for (i = 0; i < (int)nminibars; i++) max_minibarlen = MAX(max_minibarlen, (int)strcols(CHECK_STR(minilabels[i]))); - max_minibarlen += 3 + 16; /* seps + [...] */ + max_minibarlen += 3 + 15; /* seps + [...] */ max_minibarlen = MAX(max_minibarlen, MIN_WMGBOX); /* mainbar */ if (prepare_dialog(conf, text, rows, cols, &d) != 0) @@ -247,7 +247,7 @@ do_mixedgauge(struct bsddialog_conf *conf, const char *text, int rows, int cols, hnotext = maxh; } if (maxw < max_minibarlen) { - label_len_cap = maxw - (3 + 16); /* seps + [...] */ + label_len_cap = maxw - (3 + 15); /* seps + [...] */ max_minibarlen = maxw; } }