Reverse order of flows in mitmproxy.

It matches user expectations much better to have new flows appended to the bottom.
This commit is contained in:
Aldo Cortesi 2011-03-20 09:31:39 +13:00
parent 80e023b5ba
commit 4f877cde6a
3 changed files with 7 additions and 9 deletions

View File

@ -715,8 +715,6 @@ class ConsoleState(flow.State):
f = flow.State.add_request(self, req)
if self.focus is None:
self.set_focus(0)
else:
self.set_focus(self.focus + 1)
return f
def add_response(self, resp):

View File

@ -343,7 +343,7 @@ class State:
Add a request to the state. Returns the matching flow.
"""
f = Flow(req)
self.flow_list.insert(0, f)
self.flow_list.append(f)
self.flow_map[req] = f
return f

View File

@ -30,15 +30,15 @@ class uState(libpry.AutoTree):
assert c.get_next(0) == (None, None)
f2 = self._add_request(c)
assert c.get_focus() == (f, 1)
assert c.get_next(0) == (f, 1)
assert c.get_prev(1) == (f2, 0)
assert c.get_focus() == (f, 0)
assert c.get_next(0) == (f2, 1)
assert c.get_prev(1) == (f, 0)
assert c.get_next(1) == (None, None)
c.set_focus(0)
assert c.get_focus() == (f2, 0)
assert c.get_focus() == (f, 0)
c.set_focus(-1)
assert c.get_focus() == (f2, 0)
assert c.get_focus() == (f, 0)
c.delete_flow(f2)
assert c.get_focus() == (f, 0)
@ -71,7 +71,7 @@ class uState(libpry.AutoTree):
self._add_response(c)
assert not c.set_limit("~q")
assert len(c.view) == 3
assert c.focus == 2
assert c.focus == 0
class uformat_keyvals(libpry.AutoTree):