From e387c68b387a0c664743d416d9b32a669f3c1c16 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 16 Dec 2016 11:47:59 +1300 Subject: [PATCH] console: mark view indiciator, fix empty flow list behaviour Fixes #1782 --- mitmproxy/tools/console/flowlist.py | 4 ++-- mitmproxy/tools/console/statusbar.py | 6 +++++- test/mitmproxy/addons/test_view.py | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py index fd6b3babe..7d502cd12 100644 --- a/mitmproxy/tools/console/flowlist.py +++ b/mitmproxy/tools/console/flowlist.py @@ -178,8 +178,6 @@ class FlowItem(urwid.WidgetWrap): elif key == "m": self.flow.marked = not self.flow.marked signals.flowlist_change.send(self) - elif key == "M": - self.master.view.toggle_marked() elif key == "r": try: self.master.replay_request(self.flow) @@ -375,6 +373,8 @@ class FlowListBox(urwid.ListBox): prompt = "Load flows", callback = self.master.load_flows_callback ) + elif key == "M": + self.master.view.toggle_marked() elif key == "n": signals.status_prompt_onekey.send( prompt = "Method", diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py index dce8605f7..785dc766e 100644 --- a/mitmproxy/tools/console/statusbar.py +++ b/mitmproxy/tools/console/statusbar.py @@ -263,8 +263,12 @@ class StatusBar(urwid.WidgetWrap): else: arrow = common.SYMBOL_DOWN + marked = "" + if self.master.view.show_marked: + marked = "M" + t = [ - ('heading', ("%s [%s/%s]" % (arrow, offset, fc)).ljust(11)), + ('heading', ("%s %s [%s/%s]" % (arrow, marked, offset, fc)).ljust(11)), ] if self.master.server.bound: diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index 27e10058d..96f213e26 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -123,6 +123,11 @@ def test_filter(): v.set_filter(None) assert len(v) == 4 + v.toggle_marked() + assert len(v) == 0 + v.toggle_marked() + assert len(v) == 4 + v[1].marked = True v.toggle_marked() assert len(v) == 1