summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Holland <william.holland@codethink.co.uk>2015-05-30 22:25:16 +0100
committerWilliam Holland <william.holland@codethink.co.uk>2015-05-30 22:25:16 +0100
commit3e8ae61a56d8db4f027d1ac575f70d3e0c346325 (patch)
treef89d7bfd4068f3dfb4f9db9b44e6570ed6eb8904
parent552475a7b553820137fa1e57d97ba1b8dfb42261 (diff)
downloadkeyboard-python-3e8ae61a56d8db4f027d1ac575f70d3e0c346325.tar.bz2
Fix alt O and alt [ not working
-rw-r--r--keyboardpython/key.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/keyboardpython/key.py b/keyboardpython/key.py
index ed833d8..68c1c1e 100644
--- a/keyboardpython/key.py
+++ b/keyboardpython/key.py
@@ -174,10 +174,11 @@ def match_start_in_table(_code,table):
for c in table.keys():
match = re.search('^%s' % c,code_str)
if match:
- key_comb = table[match.string]
+ key_comb = table.get(match.string)
len_match = len(match.string)
_code = _code[len_match:]
return _code,key_comb
+ return _code,None
def parse_code(code):
''' get KeyCombination object from code '''
@@ -194,9 +195,11 @@ def parse_code(code):
if char == '[':
_code, key_comb = match_start_in_table(_code,
_escape_brace_codes)
+ if not key_comb: key_comb = KeyCombination('[',ALT)
elif char == 'O':
_code, key_comb = match_start_in_table(_code,
_escape_O_codes)
+ if not key_comb: key_comb = KeyCombination('O',ALT)
else: key_comb = KeyCombination(char,ALT)
elif char in _special_chars.keys():
key_comb = _special_chars[char]