Skip to content

Commit b2ad856

Browse files
committed
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).
1 parent 2283ee3 commit b2ad856

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/bsddialog/lib/barbox.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ do_mixedgauge(struct bsddialog_conf *conf, const char *text, int rows, int cols,
229229
for (i = 0; i < (int)nminibars; i++)
230230
max_minibarlen = MAX(max_minibarlen,
231231
(int)strcols(CHECK_STR(minilabels[i])));
232-
max_minibarlen += 3 + 16; /* seps + [...] */
232+
max_minibarlen += 3 + 15; /* seps + [...] */
233233
max_minibarlen = MAX(max_minibarlen, MIN_WMGBOX); /* mainbar */
234234

235235
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,
247247
hnotext = maxh;
248248
}
249249
if (maxw < max_minibarlen) {
250-
label_len_cap = maxw - (3 + 16); /* seps + [...] */
250+
label_len_cap = maxw - (3 + 15); /* seps + [...] */
251251
max_minibarlen = maxw;
252252
}
253253
}

0 commit comments

Comments
 (0)