diff options
author | hut <hut@lepus.uberspace.de> | 2013-08-20 13:58:20 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2013-08-20 13:58:20 +0200 |
commit | f94abca65edb412c9e0d97495aafb53bd01c7edf (patch) | |
tree | 7cd7a2a4edee9b9472e64872e6761c7cb394d8c3 | |
parent | 12f8b60b62a7d995af9f14ae1747b145f6dad53f (diff) | |
download | ranger-f94abca65edb412c9e0d97495aafb53bd01c7edf.tar.gz |
ext.keybinding_parser: interpret keys like <383>
sometimes ranger's keybinding parser doesn't support whatever key you want to use. In that case, it would be useful to be able to specify keys by their curses key code that can be taken from tools like /doc/tools/print_keys.py. <383> would then be interpreted as <S-DELETE>, for example.
-rw-r--r-- | ranger/ext/keybinding_parser.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index 3589b9dd..0519f69f 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -87,10 +87,13 @@ def parse_keybinding(obj): for key in keys: yield key except KeyError: - yield ord('<') - for c in bracket_content: - yield ord(c) - yield ord('>') + if string.isdigit(): + yield int(string) + else: + yield ord('<') + for c in bracket_content: + yield ord(c) + yield ord('>') except TypeError: yield keys # it was no tuple, just an int else: |