aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-04-07 16:13:42 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-04-07 16:13:42 +1200
commit8e2e83a3c6d47e52a5398f851b2900dd042f3d6a (patch)
treeca22e33e8959496cc7d83031c5c78b321224931c
parente76467e977c061d92f88500b23f11bbf3cc365bb (diff)
downloadmitmproxy-8e2e83a3c6d47e52a5398f851b2900dd042f3d6a.tar.gz
mitmproxy-8e2e83a3c6d47e52a5398f851b2900dd042f3d6a.tar.bz2
mitmproxy-8e2e83a3c6d47e52a5398f851b2900dd042f3d6a.zip
console: add g/G shortcuts throughout
g: go to end G: go to beginning
-rw-r--r--libmproxy/console/flowlist.py6
-rw-r--r--libmproxy/console/help.py1
-rw-r--r--libmproxy/console/searchable.py16
-rw-r--r--libmproxy/console/signals.py2
4 files changed, 18 insertions, 7 deletions
diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py
index 8923fd60..aa3fd718 100644
--- a/libmproxy/console/flowlist.py
+++ b/libmproxy/console/flowlist.py
@@ -309,6 +309,12 @@ class FlowListBox(urwid.ListBox):
self.master.clear_flows()
elif key == "e":
self.master.toggle_eventlog()
+ elif key == "G":
+ self.master.state.set_focus(0)
+ signals.flowlist_change.send(self)
+ elif key == "g":
+ self.master.state.set_focus(self.master.state.flow_count())
+ signals.flowlist_change.send(self)
elif key == "l":
signals.status_prompt.send(
prompt = "Limit",
diff --git a/libmproxy/console/help.py b/libmproxy/console/help.py
index 0da29907..6d36ee71 100644
--- a/libmproxy/console/help.py
+++ b/libmproxy/console/help.py
@@ -28,6 +28,7 @@ class HelpView(urwid.ListBox):
keys = [
("j, k", "down, up"),
("h, l", "left, right (in some contexts)"),
+ ("g, G", "go to end, beginning"),
("space", "page down"),
("pg up/down", "page up/down"),
("arrows", "up, down, left, right"),
diff --git a/libmproxy/console/searchable.py b/libmproxy/console/searchable.py
index 8f63c3f5..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,10 +29,16 @@ 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 super(self.__class__, self).keypress(size, key)
diff --git a/libmproxy/console/signals.py b/libmproxy/console/signals.py
index 6d429b93..c1bcf201 100644
--- a/libmproxy/console/signals.py
+++ b/libmproxy/console/signals.py
@@ -24,7 +24,7 @@ update_settings = blinker.Signal()
# Fired when a flow changes
flow_change = blinker.Signal()
-# Fired when the flow list changes
+# Fired when the flow list or focus changes
flowlist_change = blinker.Signal()
# Pop and push view state onto a stack