do not crash in a terminal < 76 columns wide
for https://bugs.launchpad.net/ubuntu-z-systems/+bug/1874314
This commit is contained in:
parent
2438a5c1b8
commit
6007b4dc41
|
@ -27,9 +27,11 @@
|
||||||
3. Make the common case as easy as possible by doing things like thinking
|
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.
|
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
|
4. Subiquity is functional in an 80x24 terminal. It doesn't matter if it
|
||||||
apart in a smaller terminal and obviously you can get more information on a
|
becomes unusable in a smaller terminal (although it shouldn't crash, as we
|
||||||
larger terminal at once, but it needs to work in 80x24.
|
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
|
### urwid specific ranting
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ class HeaderColumns(Columns):
|
||||||
center = max(int_scale(79, 101, maxcol + 1), 76)
|
center = max(int_scale(79, 101, maxcol + 1), 76)
|
||||||
message = center - btn
|
message = center - btn
|
||||||
pad = (maxcol - center)//2
|
pad = (maxcol - center)//2
|
||||||
|
if pad <= 0:
|
||||||
|
pad = 1
|
||||||
|
message = maxcol - 2 - btn
|
||||||
return [pad, message, btn, pad]
|
return [pad, message, btn, pad]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue