From a70b50fe3a3065345cf26112a2148c648695b9d9 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 12 May 2018 11:05:01 +1200 Subject: [PATCH] console: implement positions for flow list walker This papers over an urwid bug until they fix it. fixes #2973 --- mitmproxy/tools/console/flowlist.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py index e6bd1693c..a9e48af41 100644 --- a/mitmproxy/tools/console/flowlist.py +++ b/mitmproxy/tools/console/flowlist.py @@ -39,6 +39,14 @@ class FlowListWalker(urwid.ListWalker): def __init__(self, master): self.master = master + def positions(self, reverse=False): + # The stub implementation of positions can go once this issue is resolved: + # https://github.com/urwid/urwid/issues/294 + ret = range(len(self.master.view)) + if reverse: + return reversed(ret) + return ret + def view_changed(self): self._modified()