Correct a problem with tables at very small widths

Gertty would crash if the screen was narrower than the widest column
in a table.  This corrects that.

Change-Id: Ie0a2c6fae16c7c484edb6724fa5dd5f79065e94f
This commit is contained in:
James E. Blair 2014-05-26 15:00:36 -07:00
parent 844634b2f6
commit 349c5b2a62
1 changed files with 2 additions and 1 deletions

View File

@ -40,8 +40,9 @@ class FixedButton(urwid.Button):
class TableColumn(urwid.Pile):
def pack(self, size, focus=False):
maxcol = size[0]
mx = max([len(i[0].text) for i in self.contents])
return (mx+2, len(self.contents))
return (min(mx+2, maxcol), len(self.contents))
class Table(urwid.WidgetWrap):
def __init__(self, headers=[], columns=None):