diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-04-08 00:20:37 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-04-08 00:20:37 +0200 |
commit | e7b154c823af60c1aaf008858c637621ca562895 (patch) | |
tree | 9380432f9022389a814fe76a363d0d6dd6838329 /libmproxy/console/searchable.py | |
parent | 2242c671fd53a5a5a864bcdc085a2207018fd5f0 (diff) | |
parent | b961f9e599453a6116b9b2dffb73dc5b45917f80 (diff) | |
download | mitmproxy-e7b154c823af60c1aaf008858c637621ca562895.tar.gz mitmproxy-e7b154c823af60c1aaf008858c637621ca562895.tar.bz2 mitmproxy-e7b154c823af60c1aaf008858c637621ca562895.zip |
Merge branch 'master' of github.com:mitmproxy/mitmproxy
Diffstat (limited to 'libmproxy/console/searchable.py')
-rw-r--r-- | libmproxy/console/searchable.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libmproxy/console/searchable.py b/libmproxy/console/searchable.py index 9d66c718..a9572ae3 100644 --- a/libmproxy/console/searchable.py +++ b/libmproxy/console/searchable.py @@ -15,10 +15,8 @@ class Highlight(urwid.AttrMap): class Searchable(urwid.ListBox): def __init__(self, state, contents): - urwid.ListBox.__init__( - self, - urwid.SimpleFocusListWalker(contents) - ) + self.walker = urwid.SimpleFocusListWalker(contents) + urwid.ListBox.__init__(self, self.walker) self.state = state self.search_offset = 0 self.current_highlight = None @@ -31,12 +29,18 @@ class Searchable(urwid.ListBox): text = "", callback = self.set_search ) - if key == "n": + elif key == "n": self.find_next(False) - if key == "N": + elif key == "N": self.find_next(True) + elif key == "G": + self.set_focus(0) + self.walker._modified() + elif key == "g": + self.set_focus(len(self.walker)-1) + self.walker._modified() else: - return key + return super(self.__class__, self).keypress(size, key) def set_search(self, text): self.state.last_search = text |