mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
Merge pull request #3340 from kajojify/buttons
keys.yaml priority over defaultkeys.py
This commit is contained in:
commit
a8b809dcbc
@ -199,11 +199,14 @@ class KeymapConfig:
|
||||
"Error reading %s: %s" % (p, e)
|
||||
) from e
|
||||
for v in vals:
|
||||
user_ctxs = v.get("ctx", ["global"])
|
||||
try:
|
||||
km._check_contexts(user_ctxs)
|
||||
km.remove(v["key"], Contexts)
|
||||
km.add(
|
||||
key = v["key"],
|
||||
command = v["cmd"],
|
||||
contexts = v.get("ctx", ["global"]),
|
||||
contexts = user_ctxs,
|
||||
help = v.get("help", None),
|
||||
)
|
||||
except ValueError as e:
|
||||
|
@ -117,6 +117,21 @@ def test_load_path(tmpdir):
|
||||
kmc.load_path(km, dst)
|
||||
assert(km.get("chooser", "key1"))
|
||||
|
||||
km.add("key123", "str", ["flowlist", "flowview"])
|
||||
with open(dst, 'w') as f:
|
||||
f.write(
|
||||
"""
|
||||
- key: key123
|
||||
ctx: [options]
|
||||
cmd: foo
|
||||
"""
|
||||
)
|
||||
kmc.load_path(km, dst)
|
||||
for b in km.bindings:
|
||||
if b.key == "key123":
|
||||
assert b.contexts == ["options"]
|
||||
break
|
||||
|
||||
|
||||
def test_parse():
|
||||
kmc = keymap.KeymapConfig()
|
||||
|
Loading…
Reference in New Issue
Block a user