summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-14 16:14:18 +0200
committerhut <hut@lavabit.com>2010-11-22 02:28:37 +0100
commit8c73056a44b6f7a267c98eb912fba3911ed33e9a (patch)
treeadc8bdb76bbbd9bb21fc8337ab4f79bbc9bcec40 /ranger
parentcbcd332596c53b43c06206a35b7830223a0bf411 (diff)
downloadranger-8c73056a44b6f7a267c98eb912fba3911ed33e9a.tar.gz
ext.keybinding_parser: allow mapping alt+special keys
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/keybinding_parser.py16
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)