aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2018-05-11 15:00:32 +1200
committerAldo Cortesi <aldo@nullcube.com>2018-05-11 15:00:32 +1200
commit75d30212c253682f61d12b6cca5c910c798e18e1 (patch)
tree9e223f079fe59f82a71959e6dda08b3d5a3e83b6
parent9a53525b83d4250f430de8bd4b375c5695743c4c (diff)
downloadmitmproxy-75d30212c253682f61d12b6cca5c910c798e18e1.tar.gz
mitmproxy-75d30212c253682f61d12b6cca5c910c798e18e1.tar.bz2
mitmproxy-75d30212c253682f61d12b6cca5c910c798e18e1.zip
console: fix bug that caused addon commands not to appear in command list
-rw-r--r--mitmproxy/tools/console/commands.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/mitmproxy/tools/console/commands.py b/mitmproxy/tools/console/commands.py
index 1183ee9d..0f35742b 100644
--- a/mitmproxy/tools/console/commands.py
+++ b/mitmproxy/tools/console/commands.py
@@ -46,12 +46,13 @@ class CommandItem(urwid.WidgetWrap):
class CommandListWalker(urwid.ListWalker):
def __init__(self, master):
self.master = master
-
self.index = 0
- self.focusobj = None
- self.cmds = list(master.commands.commands.values())
+ self.refresh()
+
+ def refresh(self):
+ self.cmds = list(self.master.commands.commands.values())
self.cmds.sort(key=lambda x: x.signature_help())
- self.set_focus(0)
+ self.set_focus(self.index)
def get_edit_text(self):
return self.focus_obj.get_edit_text()
@@ -137,6 +138,9 @@ class Commands(urwid.Pile, layoutwidget.LayoutWidget):
)
self.master = master
+ def layout_pushed(self, prev):
+ self.widget_list[0].walker.refresh()
+
def keypress(self, size, key):
if key == "m_next":
self.focus_position = (