aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-07-21 15:54:24 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-07-23 10:41:57 +0530
commit484dbd8a7b820376831da31277092c3803578f53 (patch)
tree70b0f4f31383eaf10ab2ff1367fe1133586cdcc1
parent426a62299ceae9f9228e376acc4a153835578cba (diff)
downloadmitmproxy-484dbd8a7b820376831da31277092c3803578f53.tar.gz
mitmproxy-484dbd8a7b820376831da31277092c3803578f53.tar.bz2
mitmproxy-484dbd8a7b820376831da31277092c3803578f53.zip
Keep focus on same flow when disabling marked view
-rw-r--r--mitmproxy/console/master.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/mitmproxy/console/master.py b/mitmproxy/console/master.py
index cef4f855..499d6ea9 100644
--- a/mitmproxy/console/master.py
+++ b/mitmproxy/console/master.py
@@ -155,7 +155,7 @@ class ConsoleState(flow.State):
self.last_filter = self.limit_txt
self.set_limit(marked_filter)
- # Set Focus
+ # Restore Focus
if last_focus.marked:
self.set_focus_flow(last_focus)
else:
@@ -164,10 +164,22 @@ class ConsoleState(flow.State):
self.mark_filter = True
def disable_marked_filter(self):
+ marked_filter = "~%s" % FMarked.code
+
+ # Save Focus
+ last_focus, _ = self.get_focus()
+ nearest_marked = self.get_nearest_matching_flow(last_focus, marked_filter)
+
self.set_limit(self.last_filter)
self.last_filter = ""
+
+ # Restore Focus
+ if last_focus.marked:
+ self.set_focus_flow(last_focus)
+ else:
+ self.set_focus_flow(nearest_marked)
+
self.mark_filter = False
- self.set_focus(0)
def clear(self):
marked_flows = [f for f in self.state.view if f.marked]