openSUSE / jeos-firstboot

Lightweight firstboot wizard systemd service for SLE and openSUSE JeOS Images
MIT License
14 stars 13 forks source link

Improve menu appearance #78

Closed Vogtinator closed 3 years ago

Vogtinator commented 3 years ago

Consistent appearance and less empty space inside the dialog.

While dialog --menu allows to specify the total dialog width, height and menu item count, I was unable to find a way to get the dialog box just small enough to contain the description and menu items. There are always two empty lines below the menu list, unless we really compute dialog and menu height dynamically everywhere, which might get complex with translations and various terminal sizes...

Everything automatic results in empty lines and will overflow the backtitle if there are too many items:

dialog --menu "Choose wisely" 0 0 0 Value1 "" Value2 "": Screenshot_20210311_163552

The overflowing can be avoided by setting the menu height explicitly, which is what this PR does, but the empty lines remain:

dialog --menu "Choose wisely" 0 0 2 Value1 "" Value2 "": Screenshot_20210311_163552

By specifying the dialog height as items+5, the empty lines disappear:

dialog --menu "Choose wisely" 7 0 0 Value1 "" Value2 "" Screenshot_20210311_163848

For some reason the dialog height is ignored when there are more items than can fit - it fills the entire screen anyway! dialog --menu "Choose wisely" 20 0 0 $(seq 1 100) (screenshot omitted)

However, by specifying the menu item height explicitly as well, it's suddenly honoured again, even if the menu height is too big to fit: dialog --menu "Choose wisely" 20 0 30 $(seq 1 100) Screenshot_20210311_164410

The behaviour gets really weird in that case though, because dialog --menu "Choose wisely" 7 0 0 Value1 "" Value2 "" and dialog --menu "Choose wisely" 7 0 2 Value1 "" Value2 "" behave differently, even though they shouldn't. I assume this is because of the two empty lines at the bottom.

Any idea?

Marked as draft because I didn't check it inside jeos-firstboot yet, only outside.

Vogtinator commented 3 years ago

Apparently the bug with the empty lines at the bottom got fixed in dialog recently!

https://openqa.opensuse.org/tests/1692837#step/firstrun/5

So we just need https://bugzilla.opensuse.org/show_bug.cgi?id=1184503 fixed and then it should look nice everywhere

Vogtinator commented 3 years ago

Got applied as part of #79