[Urwid] Urwid Esc handling

David Clymer david at zettazebra.com
Sat Apr 30 23:47:05 EDT 2005

On Sat, 2005-04-30 at 16:57 -0400, Ian Ward wrote:
> 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.

Many thanks. That does the trick for me.


More information about the Urwid mailing list