From eacd742bd40013d8868fc75a29a85a14f1ee1e81 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 7 Apr 2010 18:50:50 +0200 Subject: container.keymap: support for Alt key --- ranger/container/keymap.py | 7 ++++++- test/tc_newkeys.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) 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('', 2) for i in range(1, 26): test('', i) + test('', 27, ord('x')) + test('', 27, ord('o')) test('k') test('k') -- cgit 1.4.1-2-gfad0