From 6eb584f766616b57821d88fb0c1c545afe748a6d Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Tue, 8 Mar 2016 19:42:38 +0800 Subject: [PATCH 1/2] Fix #1005 --- mitmproxy/console/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mitmproxy/console/__init__.py b/mitmproxy/console/__init__.py index f7e7b0d5a..f31c4bbc0 100644 --- a/mitmproxy/console/__init__.py +++ b/mitmproxy/console/__init__.py @@ -58,6 +58,8 @@ class ConsoleState(flow.State): super(ConsoleState, self).update_flow(f) if self.focus is None: self.set_focus(0) + elif self.follow_focus: + self.set_focus(self.flow_count()) return f def set_limit(self, limit): From 426f84d93036f1a9236061259c53cc2d36bd3d46 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Fri, 11 Mar 2016 08:44:51 +0800 Subject: [PATCH 2/2] Add update_focus method in console/__init__.py. --- mitmproxy/console/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mitmproxy/console/__init__.py b/mitmproxy/console/__init__.py index f31c4bbc0..16615cbc8 100644 --- a/mitmproxy/console/__init__.py +++ b/mitmproxy/console/__init__.py @@ -50,7 +50,7 @@ class ConsoleState(flow.State): if self.focus is None: self.set_focus(0) elif self.follow_focus: - self.set_focus(len(self.view) - 1) + self.update_focus() self.set_flow_marked(f, False) return f @@ -59,7 +59,7 @@ class ConsoleState(flow.State): if self.focus is None: self.set_focus(0) elif self.follow_focus: - self.set_focus(self.flow_count()) + self.update_focus() return f def set_limit(self, limit): @@ -82,6 +82,9 @@ class ConsoleState(flow.State): else: self.focus = None + def update_focus(self): + self.set_focus(len(self.view) - 1) + def set_focus_flow(self, f): self.set_focus(self.view.index(f))