Hi,
I recently started toying around the urwid library and I happened to
encounter a bug.
If the terminal is in UTF-8 mode and I input a keybind consisting of
meta and some non-ASCII character, urwid fails with an exception like
this:
,----
| File "/var/lib/python-support/python2.4/urwid/raw_display.py", line 244, in
get_input
| keys, raw = self._get_input( self.max_wait )
| File "/var/lib/python-support/python2.4/urwid/raw_display.py", line 299, in
_get_input
| run, keys = escape.process_keyqueue(keys, more_fn)
| File "/var/lib/python-support/python2.4/urwid/escape.py", line 283, in
process_keyqueue
| return ['meta '+run[0]]+run[1:], keys
| TypeError: can only concatenate list (not "unicode") to list
`----
This is fixed by the simple patch:
Index: urwid-0.9.7.1/urwid/escape.py
===================================================================
--- urwid-0.9.7.1.orig/urwid/escape.py 2006-10-11 17:23:01.000000000 +0300
+++ urwid-0.9.7.1/urwid/escape.py 2006-10-11 17:23:19.000000000 +0300
@@ -259,7 +259,7 @@
s = "".join([chr(c)for c in [code]+keys[:need_more]])
try:
- return s.decode("utf-8"), keys[need_more:]
+ return [s.decode("utf-8")], keys[need_more:]
except UnicodeDecodeError:
return ["<%d>"%code],keys
I guess this is what was originally meant - it will make the
keypresses be returned as u'meta \xa7', for example.
-- Naked
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid