mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 11:19:23 +00:00
fix #2738
This commit is contained in:
parent
eb53cc7ed2
commit
3b22433ca7
@ -234,28 +234,34 @@ class Window(urwid.Frame):
|
|||||||
self.view_changed()
|
self.view_changed()
|
||||||
self.focus_changed()
|
self.focus_changed()
|
||||||
|
|
||||||
|
def stacks_sorted_by_focus(self):
|
||||||
|
"""
|
||||||
|
Returns:
|
||||||
|
self.stacks, with the focused stack first.
|
||||||
|
"""
|
||||||
|
stacks = self.stacks.copy()
|
||||||
|
stacks.insert(0, stacks.pop(self.pane))
|
||||||
|
return stacks
|
||||||
|
|
||||||
def current(self, keyctx):
|
def current(self, keyctx):
|
||||||
"""
|
"""
|
||||||
Returns the active widget, but only the current focus or overlay has
|
Returns the active widget with a matching key context, including overlays.
|
||||||
a matching key context.
|
If multiple stacks have an active widget with a matching key context,
|
||||||
|
the currently focused stack is preferred.
|
||||||
"""
|
"""
|
||||||
t = self.focus_stack().top_widget()
|
for s in self.stacks_sorted_by_focus():
|
||||||
if t.keyctx == keyctx:
|
t = s.top_widget()
|
||||||
return t
|
if t.keyctx == keyctx:
|
||||||
|
return t
|
||||||
|
|
||||||
def current_window(self, keyctx):
|
def current_window(self, keyctx):
|
||||||
"""
|
"""
|
||||||
Returns the active window, ignoring overlays.
|
Returns the active window with a matching key context, ignoring overlays.
|
||||||
|
If multiple stacks have an active widget with a matching key context,
|
||||||
|
the currently focused stack is preferred.
|
||||||
"""
|
"""
|
||||||
t = self.focus_stack().top_window()
|
for s in self.stacks_sorted_by_focus():
|
||||||
if t.keyctx == keyctx:
|
t = s.top_window()
|
||||||
return t
|
|
||||||
|
|
||||||
def any(self, keyctx):
|
|
||||||
"""
|
|
||||||
Returns the top window of either stack if they match the context.
|
|
||||||
"""
|
|
||||||
for t in [x.top_window() for x in self.stacks]:
|
|
||||||
if t.keyctx == keyctx:
|
if t.keyctx == keyctx:
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user