mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
* Fix #4614 Options and Keybinding screen: home and end crash mitmproxy * fix flake8 * Add integration test for fix to #4614 * fix the flake8, again.
This commit is contained in:
parent
3b87d3f66e
commit
68cc3e721f
@ -66,6 +66,7 @@ class KeyListWalker(urwid.ListWalker):
|
||||
self.index = index
|
||||
self.focus_obj = self._get(self.index)
|
||||
keybinding_focus_change.send(binding.help or "")
|
||||
self._modified()
|
||||
|
||||
def get_next(self, pos):
|
||||
if pos >= len(self.bindings) - 1:
|
||||
@ -79,6 +80,12 @@ class KeyListWalker(urwid.ListWalker):
|
||||
return None, None
|
||||
return self._get(pos), pos
|
||||
|
||||
def positions(self, reverse=False):
|
||||
if reverse:
|
||||
return reversed(range(len(self.bindings)))
|
||||
else:
|
||||
return range(len(self.bindings))
|
||||
|
||||
|
||||
class KeyList(urwid.ListBox):
|
||||
def __init__(self, master):
|
||||
|
@ -142,6 +142,7 @@ class OptionListWalker(urwid.ListWalker):
|
||||
self.index = index
|
||||
self.focus_obj = self._get(self.index, self.editing)
|
||||
option_focus_change.send(opt.help)
|
||||
self._modified()
|
||||
|
||||
def get_next(self, pos):
|
||||
if pos >= len(self.opts) - 1:
|
||||
@ -155,6 +156,12 @@ class OptionListWalker(urwid.ListWalker):
|
||||
return None, None
|
||||
return self._get(pos, False), pos
|
||||
|
||||
def positions(self, reverse=False):
|
||||
if reverse:
|
||||
return reversed(range(len(self.opts)))
|
||||
else:
|
||||
return range(len(self.opts))
|
||||
|
||||
|
||||
class OptionsList(urwid.ListBox):
|
||||
def __init__(self, master):
|
||||
|
@ -43,3 +43,11 @@ def test_integration(tdata, console):
|
||||
console.type(f":view.flows.load {tdata.path('mitmproxy/data/dumpfile-7.mitm')}<enter>")
|
||||
console.type("<enter><tab><tab>")
|
||||
console.type("<space><tab><tab>") # view second flow
|
||||
|
||||
|
||||
def test_options_home_end(console):
|
||||
console.type("O<home><end>")
|
||||
|
||||
|
||||
def test_keybindings_home_end(console):
|
||||
console.type("K<home><end>")
|
Loading…
Reference in New Issue
Block a user