[Urwid] Urwid Esc handling

Ian Ward ian at excess.org
Sat Apr 30 16:57:21 EDT 2005


David Clymer wrote:

>Is there a way to change how urwid (or maybe it's ncurses, I don't know)
>does Esc detection? I'm writing a program with VI-like keybindings, so
>Esc is used frequently to change between editing modes. Currently, I
>have to hit Esc, then wait a approx 1 second before typing anything else
>in order to make it clear to urwid that I am not attempting to enter a
>control sequence of some sort. If there was a way to turn that off, it
>would be mighty handy.
>
ncurses is responsible for the 1s delay.

In curses_display.py line line 182 reads:
   self.s.keypad(1)
change it to:
   self.s.keypad(0)

This turns off ncurses' interpretation of some escape sequences, which 
is a good thing, but I'll have to update curses_display.Screen to handle 
the escape sequences that ncurses was detecting (mostly F-keys and 
keypad keys).  I'll try to get this change into the next release.

You can run curses_display.py as a script to test keyboard input before 
and after the change.

Ian



More information about the Urwid mailing list