Fix the crash on Escape key

This commit is contained in:
Florent Le Coz 2011-07-31 19:03:15 +02:00
parent c2ba5388a5
commit a93069e3a0

View file

@ -63,6 +63,9 @@ def read_char(s, timeout=1000):
continue continue
if first == 27: if first == 27:
second = read_char(s, 0) second = read_char(s, 0)
if second is None: # if escape was pressed, a second char
# has to be read. But it timed out.
return None
res = 'M-%s' % (second[0],) res = 'M-%s' % (second[0],)
ret_list.append(res) ret_list.append(res)
(first, char) = get_next_byte(s) (first, char) = get_next_byte(s)