summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-07 18:50:50 +0200
committerhut <hut@lavabit.com>2010-04-07 18:50:50 +0200
commiteacd742bd40013d8868fc75a29a85a14f1ee1e81 (patch)
treec4606a28908530e19452f6e9af3eb215f6cb04f3
parent894665269984ebf9f07bd9cae681ba2057715e25 (diff)
downloadranger-eacd742bd40013d8868fc75a29a85a14f1ee1e81.tar.gz
container.keymap: support for Alt key
-rw-r--r--ranger/container/keymap.py7
-rw-r--r--test/tc_newkeys.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py
index 41875cb2..dee54430 100644
--- a/ranger/container/keymap.py
+++ b/ranger/container/keymap.py
@@ -295,6 +295,7 @@ special_keys = {
 }
 for char in ascii_lowercase:
 	special_keys['c-' + char] = ord(char) - 96
+	special_keys['a-' + char] = (27, ord(char))
 
 def translate_keys(obj):
 	"""
@@ -318,12 +319,16 @@ def translate_keys(obj):
 					in_brackets = False
 					string = ''.join(bracket_content).lower()
 					try:
-						yield special_keys[string]
+						keys = special_keys[string]
+						for key in keys:
+							yield key
 					except KeyError:
 						yield ord('<')
 						for c in bracket_content:
 							yield ord(c)
 						yield ord('>')
+					except TypeError:
+						yield keys  # it was no tuple, just an int
 				else:
 					bracket_content.append(char)
 			else:
diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py
index bcf08e5f..bbfc74e9 100644
--- a/test/tc_newkeys.py
+++ b/test/tc_newkeys.py
@@ -136,6 +136,8 @@ class Test(PressTestCase):
 		test('<C-b>', 2)
 		for i in range(1, 26):
 			test('<C-' + chr(i+ord('a')-1) + '>', i)
+		test('<A-x>', 27, ord('x'))
+		test('<a-o>', 27, ord('o'))
 		test('k<a')
 		test('k<anz>')
 		test('k<a<nz>')