mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
remove code duplication
This commit is contained in:
parent
4cd170d36c
commit
f5a6ebf584
@ -47,18 +47,12 @@ class ConsoleState(flow.State):
|
||||
|
||||
def add_flow(self, f):
|
||||
super(ConsoleState, self).add_flow(f)
|
||||
if self.focus is None:
|
||||
self.set_focus(0)
|
||||
elif self.follow_focus:
|
||||
self.update_focus()
|
||||
self.set_flow_marked(f, False)
|
||||
return f
|
||||
|
||||
def update_flow(self, f):
|
||||
super(ConsoleState, self).update_flow(f)
|
||||
if self.focus is None:
|
||||
self.set_focus(0)
|
||||
elif self.follow_focus:
|
||||
self.update_focus()
|
||||
return f
|
||||
|
||||
@ -83,6 +77,9 @@ class ConsoleState(flow.State):
|
||||
self.focus = None
|
||||
|
||||
def update_focus(self):
|
||||
if self.focus is None:
|
||||
self.set_focus(0)
|
||||
elif self.follow_focus:
|
||||
self.set_focus(len(self.view) - 1)
|
||||
|
||||
def set_focus_flow(self, f):
|
||||
|
Loading…
Reference in New Issue
Block a user