summaryrefslogtreecommitdiff
path: root/lib/lib_util.c
diff options
context:
space:
mode:
authorAlfonso S. Siciliano <asiciliano@FreeBSD.org>2022-09-25 13:04:33 +0000
committerAlfonso S. Siciliano <asiciliano@FreeBSD.org>2022-09-25 13:04:33 +0000
commit9f24fda5a8e7ab8243e71473c7e2dc98b4877e64 (patch)
treecf0c83c2ef1a564eb8bd492fde38c52a9fcdfca0 /lib/lib_util.c
parent2c9fd7655ba54e7239f528e1af9fe09662de9b03 (diff)
Diffstat (limited to 'lib/lib_util.c')
-rw-r--r--lib/lib_util.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/lib_util.c b/lib/lib_util.c
index fcdf4c3d8769..d8c0f1d21b42 100644
--- a/lib/lib_util.c
+++ b/lib/lib_util.c
@@ -921,11 +921,8 @@ set_widget_size(struct bsddialog_conf *conf, int rows, int cols, int *h, int *w)
*h = maxheight;
else if (rows < BSDDIALOG_FULLSCREEN)
RETURN_ERROR("Negative (less than -1) height");
- else if (rows > BSDDIALOG_AUTOSIZE) {
- if ((*h = rows) > maxheight)
- RETURN_ERROR("Height too big (> terminal height - "
- "shadow)");
- }
+ else if (rows > BSDDIALOG_AUTOSIZE) /* fixed rows */
+ *h = MIN(rows, maxheight); /* rows is at most maxheight */
/* rows == AUTOSIZE: each widget has to set its size */
if ((maxwidth = widget_max_width(conf)) == BSDDIALOG_ERROR)
@@ -935,11 +932,8 @@ set_widget_size(struct bsddialog_conf *conf, int rows, int cols, int *h, int *w)
*w = maxwidth;
else if (cols < BSDDIALOG_FULLSCREEN)
RETURN_ERROR("Negative (less than -1) width");
- else if (cols > BSDDIALOG_AUTOSIZE) {
- if ((*w = cols) > maxwidth)
- RETURN_ERROR("Width too big (> terminal width - "
- "shadow)");
- }
+ else if (cols > BSDDIALOG_AUTOSIZE) /* fixed cols */
+ *w = MIN(cols, maxwidth); /* cols is at most maxwidth */
/* cols == AUTOSIZE: each widget has to set its size */
return (0);