do not crash in a terminal < 76 columns wide

for https://bugs.launchpad.net/ubuntu-z-systems/+bug/1874314
This commit is contained in:
Michael Hudson-Doyle 2020-04-28 21:32:46 +12:00
parent 2438a5c1b8
commit 6007b4dc41
2 changed files with 8 additions and 3 deletions

View File

@ -27,9 +27,11 @@
3. Make the common case as easy as possible by doing things like thinking
about which widget should be highlighted when a screen is first shown.
4. Subiquity is functional in an 80x24 terminal. It doesn't matter if it falls
apart in a smaller terminal and obviously you can get more information on a
larger terminal at once, but it needs to work in 80x24.
4. Subiquity is functional in an 80x24 terminal. It doesn't matter if it
becomes unusable in a smaller terminal (although it shouldn't crash, as we
support people logging in via ssh and they can resize their terminal
however they like) and obviously you can get more information on a larger
terminal at once, but it needs to work in 80x24.
### urwid specific ranting

View File

@ -54,6 +54,9 @@ class HeaderColumns(Columns):
center = max(int_scale(79, 101, maxcol + 1), 76)
message = center - btn
pad = (maxcol - center)//2
if pad <= 0:
pad = 1
message = maxcol - 2 - btn
return [pad, message, btn, pad]