aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-06-13 16:10:40 +1200
committerAldo Cortesi <aldo@nullcube.com>2017-06-13 16:10:40 +1200
commit09128d9d1a5f93234ffe904e576cf43d8103dfc5 (patch)
treee7ee039328e5554c236d5cd87f425beb5a7de511
parent4a7cafee9efe1bff21d95eba0e5d42d610e70484 (diff)
downloadmitmproxy-09128d9d1a5f93234ffe904e576cf43d8103dfc5.tar.gz
mitmproxy-09128d9d1a5f93234ffe904e576cf43d8103dfc5.tar.bz2
mitmproxy-09128d9d1a5f93234ffe904e576cf43d8103dfc5.zip
console: keymap - list keys with modifiers separately
-rw-r--r--mitmproxy/tools/console/defaultkeys.py2
-rw-r--r--mitmproxy/tools/console/keymap.py9
2 files changed, 7 insertions, 4 deletions
diff --git a/mitmproxy/tools/console/defaultkeys.py b/mitmproxy/tools/console/defaultkeys.py
index 799ffb4e..18298003 100644
--- a/mitmproxy/tools/console/defaultkeys.py
+++ b/mitmproxy/tools/console/defaultkeys.py
@@ -1,6 +1,6 @@
def map(km):
- km.add(":", "console.command ''", ["global"], "Command prompt")
+ km.add(":", "console.command ", ["global"], "Command prompt")
km.add("?", "console.view.help", ["global"], "View help")
km.add("C", "console.view.commands", ["global"], "View commands")
km.add("K", "console.view.keybindings", ["global"], "View key bindings")
diff --git a/mitmproxy/tools/console/keymap.py b/mitmproxy/tools/console/keymap.py
index 19994db7..06bcca9a 100644
--- a/mitmproxy/tools/console/keymap.py
+++ b/mitmproxy/tools/console/keymap.py
@@ -60,9 +60,12 @@ class Keymap:
return None
def list(self, context: str) -> typing.Sequence[Binding]:
- b = [b for b in self.bindings if context in b.contexts or context == "all"]
- b.sort(key=lambda x: x.key)
- return b
+ b = [x for x in self.bindings if context in x.contexts or context == "all"]
+ single = [x for x in b if len(x.key.split()) == 1]
+ multi = [x for x in b if len(x.key.split()) != 1]
+ single.sort(key=lambda x: x.key)
+ multi.sort(key=lambda x: x.key)
+ return single + multi
def handle(self, context: str, key: str) -> typing.Optional[str]:
"""