[Urwid] Problem with Alt/Meta key

Ian Ward ian at excess.org
Fri May 5 10:49:24 EDT 2006


Rebecca Breu wrote:
> But in input_test.py, it doesn't. For example Alt+q produces the
> spanish charakter n with a ~ on top of it. The *only* way to
> get input_test.py to display 'meta q' is pressing the escape key
> and then 'q', but you have to be *very* fast.
> 
> However, the Alt key works properly in all other (non-urwid)
> programs I tested, and in 'emacs -nw' (which I think uses curses,
> too).

This sounds like the same problem I have when I use a real xterm in 
Linux without setting "Meta Sends Escape" (ctrl+left-click menu).

In this mode xterm sends (character code + 128) instead of prefixing the 
character with esc.  Unfortunately, this conflicts with the use of 8 bit 
encodings that send characters in the range 128-255.  I chose to 
interpret this input as characters instead of meta+key sequences so that 
Urwid would support ISO-8859-*, EUC-*, and other encodings that use all 
8 bits for their characters.

It's a difficult problem.

I could try to connect to the user's X client to read the key codes via 
the X protocol (the way xev does). Of course, that won't work without X 
forwarding configured.  I think that's what vim does, perhaps your other 
program does the same thing..

Ian




More information about the Urwid mailing list