mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Side-step a bug in Urwid < 1.0
Urwid barfs when given a fixed-size column of width zero.
This commit is contained in:
parent
5f1d7a0746
commit
b74ba817ea
@ -43,20 +43,20 @@ def format_keyvals(lst, key="key", val="text", indent=0):
|
|||||||
if kv is None:
|
if kv is None:
|
||||||
ret.append(urwid.Text(""))
|
ret.append(urwid.Text(""))
|
||||||
else:
|
else:
|
||||||
ret.append(
|
cols = []
|
||||||
urwid.Columns(
|
# This cumbersome construction process is here for a reason:
|
||||||
[
|
# Urwid < 1.0 barfs if given a fixed size column of size zero.
|
||||||
("fixed", indent, urwid.Text("")),
|
if indent:
|
||||||
|
cols.append(("fixed", indent, urwid.Text("")))
|
||||||
|
cols.extend([
|
||||||
(
|
(
|
||||||
"fixed",
|
"fixed",
|
||||||
maxk,
|
maxk,
|
||||||
urwid.Text([(key, kv[0] or "")])
|
urwid.Text([(key, kv[0] or "")])
|
||||||
),
|
),
|
||||||
urwid.Text([(val, kv[1])])
|
urwid.Text([(val, kv[1])])
|
||||||
],
|
])
|
||||||
dividechars = 2
|
ret.append(urwid.Columns(cols, dividechars = 2))
|
||||||
)
|
|
||||||
)
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user