diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py index dc846b7a2..651c43306 100644 --- a/mitmproxy/tools/console/flowview.py +++ b/mitmproxy/tools/console/flowview.py @@ -194,10 +194,6 @@ class FlowDetails(tabs.Tabs): ] return searchable.Searchable(txt) - def keypress(self, size, key): - key = super().keypress(size, key) - return self._w.keypress(size, key) - class FlowView(urwid.Frame, layoutwidget.LayoutWidget): keyctx = "flowview" diff --git a/mitmproxy/tools/console/help.py b/mitmproxy/tools/console/help.py index 959f77635..439289f63 100644 --- a/mitmproxy/tools/console/help.py +++ b/mitmproxy/tools/console/help.py @@ -6,6 +6,21 @@ from mitmproxy.tools.console import layoutwidget from mitmproxy.tools.console import tabs +class CListBox(urwid.ListBox): + def __init__(self, contents): + self.length = len(contents) + contents = contents[:] + [urwid.Text(["\n"])] * 5 + super().__init__(contents) + + def keypress(self, size, key): + if key == "m_end": + self.set_focus(self.length - 1) + elif key == "m_start": + self.set_focus(0) + else: + return super().keypress(size, key) + + class HelpView(tabs.Tabs, layoutwidget.LayoutWidget): title = "Help" keyctx = "help" @@ -54,7 +69,7 @@ class HelpView(tabs.Tabs, layoutwidget.LayoutWidget): text.extend(self.format_keys(self.master.keymap.list("global"))) - return urwid.ListBox(text) + return CListBox(text) def filtexp_title(self): return "Filter Expressions" @@ -83,7 +98,7 @@ class HelpView(tabs.Tabs, layoutwidget.LayoutWidget): text.extend( common.format_keyvals(examples, key="key", val="text", indent=4) ) - return urwid.ListBox(text) + return CListBox(text) def layout_pushed(self, prev): """