diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-08-07 00:28:47 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-08-07 00:28:47 +0000 |
commit | 6b92b3cffd9b976018b7c68f2a2b3d0b5880e9e6 (patch) | |
tree | 61eee9cbaf39670abbe758fa10793f80fe6dd082 /src/keyboard.py | |
parent | 6796ebd99867bae16dd4bbaa23ec23a6105b0abc (diff) | |
download | poezio-6b92b3cffd9b976018b7c68f2a2b3d0b5880e9e6.tar.gz poezio-6b92b3cffd9b976018b7c68f2a2b3d0b5880e9e6.tar.bz2 poezio-6b92b3cffd9b976018b7c68f2a2b3d0b5880e9e6.tar.xz poezio-6b92b3cffd9b976018b7c68f2a2b3d0b5880e9e6.zip |
Begin of a /whois command. Also, ALSMO fixed 1710
Diffstat (limited to 'src/keyboard.py')
-rw-r--r-- | src/keyboard.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/keyboard.py b/src/keyboard.py index 8e341bc6..90bd79ef 100644 --- a/src/keyboard.py +++ b/src/keyboard.py @@ -23,6 +23,8 @@ of the time ONE char, but may be longer if it's a keyboard 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 @@ -31,7 +33,7 @@ def get_next_byte(s): c = s.getkey() except: return (None, "KEY_RESIZE") - if len(c) > 4: + if len(c) >= 4: return (None, c) return (ord(c), c) @@ -52,12 +54,15 @@ def read_char(s): (first, c) = get_next_byte(s) char = "M-"+c if 194 <= first: + debug('1\n') (code, c) = get_next_byte(s) # 2 bytes char char += c if 224 <= first: + debug('2\n') (code, c) = get_next_byte(s) # 3 bytes char char += c if 240 <= first: + debug('3\n') (code, c) = get_next_byte(s) # 4 bytes char char += c return char |