From 8c73056a44b6f7a267c98eb912fba3911ed33e9a Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 14 Oct 2010 16:14:18 +0200 Subject: ext.keybinding_parser: allow mapping alt+special keys --- ranger/ext/keybinding_parser.py | 16 ++++++++++++---- 1 file 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) -- cgit 1.4.1-2-gfad0