On Wed, Dec 17, 2025 at 01:38:01PM -0800, Mike Castle wrote:
> 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.hmm - those all call dlg_auto_size, passing the parameter `boxlines' as the sum of a widget-specific constant MIN_HIGH, and the requested height. That calls dlg_auto_sizefile, which counts the actual length, and (adding 2) caps that according to the screen's limit on the dialog size. so... if I'm reading things properly, MIN_HIGH may be where most of the off-by-one comes from, while dlg_auto_sizefile may account for the 2. As I recall it (long ago), I added the MIN_HIGH symbol when working on the timebox and calendar, since they didn't fit the usual list format. I'll add a to-do to review this stuff and see how to tighten up the limits. > 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 ] ... -- Thomas E. Dickey <[email protected]> https://invisible-island.net
signature.asc
Description: PGP signature
