[Urwid] [PATCH] fix meta utf8 characters

Nuutti Kotivuori naked at iki.fi
Wed Oct 11 10:29:11 EDT 2006


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

|   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:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-meta-utf8-chars.patch
Type: text/x-patch
Size: 499 bytes
Desc: not available
Url : http://lists.excess.org/pipermail/urwid/attachments/20061011/e409926f/fix-meta-utf8-chars.bin
-------------- next part --------------

I guess this is what was originally meant - it will make the
keypresses be returned as u'meta \xa7', for example.

-- Naked

More information about the Urwid mailing list