diff options
author | hut <hut@lavabit.com> | 2010-10-14 16:14:18 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-10-14 16:14:18 +0200 |
commit | 1640991f9364447613c140b022cdf5165a3456f3 (patch) | |
tree | 995a4c2baa6a377305ee2a9ffd3df5d1fb0b4398 /ranger | |
parent | 1c907e9a50c55cb787aab2e6d76453eaf39398b1 (diff) | |
download | ranger-1640991f9364447613c140b022cdf5165a3456f3.tar.gz |
ext.keybinding_parser: allow mapping alt+special keys
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/keybinding_parser.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index 015d173f..e044d80d 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -66,10 +66,13 @@ DIRKEY = 9001 ANYKEY = 9002 PASSIVE_ACTION = 9003 -special_keys = { +very_special_keys = { 'dir': DIRKEY, 'any': ANYKEY, 'bg': PASSIVE_ACTION, +} + +special_keys = { 'bs': curses.KEY_BACKSPACE, 'backspace': curses.KEY_BACKSPACE, 'backspace2': curses.ascii.DEL, @@ -92,11 +95,16 @@ special_keys = { 's-tab': curses.KEY_BTAB, } -for char in ascii_lowercase: - special_keys['c-' + char] = ord(char) - 96 +for key, val in special_keys.items(): + special_keys['a-' + key] = (27, val) -for char in (ascii_lowercase + '0123456789'): +for char in ascii_lowercase + '0123456789': special_keys['a-' + char] = (27, ord(char)) +for char in ascii_lowercase: + special_keys['c-' + char] = ord(char) - 96 + for n in range(64): special_keys['f' + str(n)] = curses.KEY_F0 + n + +special_keys.update(very_special_keys) |