summaryrefslogtreecommitdiff
path: root/src/keyboard.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-19 19:38:33 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-19 19:38:33 +0000
commite656e5924bef38d5e69fffca6e1d46c7bed69139 (patch)
tree34d5a397997a4d1bd0fbd0de660d7dc7b77ce287 /src/keyboard.py
parent93351156a122dd7e374778c1c838b5c4c1dda83d (diff)
downloadpoezio-e656e5924bef38d5e69fffca6e1d46c7bed69139.tar.gz
poezio-e656e5924bef38d5e69fffca6e1d46c7bed69139.tar.bz2
poezio-e656e5924bef38d5e69fffca6e1d46c7bed69139.tar.xz
poezio-e656e5924bef38d5e69fffca6e1d46c7bed69139.zip
fixes some stuff. Also fixed #1617
Diffstat (limited to 'src/keyboard.py')
-rw-r--r--src/keyboard.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/keyboard.py b/src/keyboard.py
index c9836250..c06e66ec 100644
--- a/src/keyboard.py
+++ b/src/keyboard.py
@@ -21,14 +21,17 @@
Functions to interact with the keyboard
Mainly, read keys entered and return a string (most
of the time ONE char, but may be longer if it's a keyboard
-shortcut, like ^A or KEY_RESIZE)
+shortcut, like ^A, M-a or KEY_RESIZE)
"""
+from common import debug
+
def get_next_byte(s):
"""
Read the next byte of the utf-8 char
"""
c = s.getkey()
+ debug(c)
if len(c) > 4:
return (None, c)
return (ord(c), c)
@@ -45,16 +48,16 @@ def read_char(s):
if first <= 26: # transform Ctrl+* keys
char = "^"+chr(first + 64)
if first == 27:
- (_, c) = get_next_byte(s)
+ (first, c) = get_next_byte(s)
char = "M-"+c
- return char
+ # return char
if 194 <= first:
(code, c) = get_next_byte(s) # 2 bytes char
char += c
if 224 <= first:
(code, c) = get_next_byte(s) # 3 bytes char
char += c
- if 240 <= code:
+ if 240 <= first:
(code, c) = get_next_byte(s) # 4 bytes char
char += c
return char