If this is working-as-intended, I could not find it documented.

Tested with menu, checklist, radiolist, and buildlist.

Whenever the a value, N, is used  for {menu,list}-height, the widget
actually uses N+1 or N+2 depending on other settings.  Specifically,
if "width" is 0, then the delta is 2.  If it is set, even to the same
value that --print-size would display, then the delta is 1.

$ dialog --version
Version: 1.3-20250817

$ dialog --print-maxsize
MaxSize: 24, 80

$ dialog --menu test 0 0 1 $(printf ' %d %d-abc' $(seq 40))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │       1   2-abc        │ │
│ │       3   4-abc        │ │
│ │       5   6-abc        │ │
│ └────↓(+)────────15%─────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

$ dialog --menu test 0 30 1 $(printf ' %d %d-abc' $(seq 40))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │       1   2-abc        │ │
│ │       3   4-abc        │ │
│ └────↓(+)────────10%─────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

$ dialog --menu test 0 0 5 $(printf ' %d %d-abc' $(seq 40))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │       1   2-abc        │ │
│ │       3   4-abc        │ │
│ │       5   6-abc        │ │
│ │       7   8-abc        │ │
│ │       9   10-abc       │ │
│ │       11  12-abc       │ │
│ │       13  14-abc       │ │
│ └────↓(+)────────35%─────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

$ dialog --menu test 0 30 5 $(printf ' %d %d-abc' $(seq 40))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │       1   2-abc        │ │
│ │       3   4-abc        │ │
│ │       5   6-abc        │ │
│ │       7   8-abc        │ │
│ │       9   10-abc       │ │
│ │       11  12-abc       │ │
│ └────↓(+)────────30%─────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

$ dialog --checklist test 0 0 5 $(printf ' %d %d-abc off' $(seq 40))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │     [ ] 1   2-abc      │ │
│ │     [ ] 3   4-abc      │ │
│ │     [ ] 5   6-abc      │ │
│ │     [ ] 7   8-abc      │ │
│ │     [ ] 9   10-abc     │ │
│ │     [ ] 11  12-abc     │ │
│ │     [ ] 13  14-abc     │ │
│ └─────────↓(+)───35%─────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

$ dialog --radiolist test 0 30 1 $(printf ' %d %d-abc off' $(seq 40))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │     ( ) 1   2-abc      │ │
│ │     ( ) 3   4-abc      │ │
│ └─────────↓(+)───10%─────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

Oh, while writing this, I just realized that there are always 1/2
lines added to the end of lists if the list is short.

$ dialog --menu test 0 30 0 $(printf ' %d %d-abc' $(seq 2))
┌────────────────────────────┐
│ test                       │
│ ┌────────────────────────┐ │
│ │        1  2-abc        │ │
│ │                        │ │
│ └────────────────────────┘ │
├────────────────────────────┤
│   <  OK  >  <Cancel>       │
└────────────────────────────┘

I had noticed that before, but did not click until now.


As an aside, I noticed that in the man page, the field is regularly
listed as "menu-height" and "list-height".  But "formheight" is always
used without the hyphen.

$ man dialog | grep height | grep -e menu -e form -e list
       --buildlist text height width list-height [ tag item status ] ...
       --checklist text height width list-height [ tag item status ] ...
       --form text height width formheight [ label y x item y x flen ilen ] ...
       --inputmenu text height width menu-height [ tag item ] ...
       --menu text height width menu-height [ tag item ] ...
              key, or the number keys  1  through  9.   There  are  menu-height
       --mixedform text height width formheight [ label y x item y x
flen ilen itype ] ...
       --passwordform text height width formheight [ label y x item y
x flen ilen ] ...
       --radiolist text height width list-height  [ tag item status ] ...
       --treeview text height width list-height [ tag item status depth ] ...

Reply via email to