Make sure the wizard buttons always remain visible in NCurses (SLE-15-SP1 branch) #926
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is for the SLE-15-SP1 branch. The merge to master will follow.
Trello
https://trello.com/c/kUpqSPGu
Bugzilla
https://bugzilla.suse.com/show_bug.cgi?id=1133367
Problem
In the NCurses UI, the wizard buttons can disappear when the wizard content is too large.
Notice there are no wizard buttons visible.
Cause
Unlike in the Qt UI, the NCurses UI does not have a dedicated Wizard widget; a wizard dialog is pieced together from standard widgets. This includes the outer wizard dialog, the wizard buttons and the framework for the wizard contents which is basically a fancy ReplacePoint where the application later puts the dialog content.
Since all those parts were created equal, in case the UI runs out of screen space because a wizard dialog is overcrowded, it has to cut off widgets somewhere. In the standard algorithm it cuts off some part of all the widgets in the dimension where there is not enough space; so the dialog content loses some space, and the wizard buttons also lose some space.
But since an NCurses button is only one line high, it will quickly disappear if that happens in the vertical dimension, making the buttons useless.
Fix
Give higher layout priority to the wizard buttons, i.e. lower the layout priority for the dialog content in the vertical dimension.
This is commonly done with a VWeight widget: In a VBox, each item gets the space that it reports it needs, and excess space is distributed evenly or, if there are VWeights, according to those VWeights.
In the opposite case when there is not enough space, the widgets without a VWeight get their desired space, and the rest goes to the widgets with a VWeight. If there is only one of those, it gets all the remaining space.
Screenshots
80x24: The problematic case in this bug. Notice the wizard buttons are now there alright.
128x40: Works fine with much larger than standard resolution.
80x20: Even works fine with much less resolution (but this is really pushing the limits).
Effect on other dialogs and modules
They won't ever lose their wizard buttons again. They will be the last screen element to disappear.
So this fix fixes not only this particular case, but all NCurses wizard buttons in all dialogs and modules forevermore.
The diff is best viewed with Diff Settings -> Hide Whitespace Changes.