rlucas.net: The Next Generation Rotating Header Image

Curses::UI Escape key bindings are slow; here’s why.

I am throwing together a quick Curses (console / terminal) based UI for a database here, prior to putting (or hiring someone to put!) a Web front-end on it. In keeping with my experience with elinks, I wanted the menubar activation key to be Escape. However, it was running slower than molasses in February — it seemed to take a FULL SECOND before the Esc key would register and focus / unfocus the menubar.

Well, poking around a bit gave me the answer. From man ncurses(3):

ESCDELAY   Specifies the total time, in milliseconds, for which ncurses will   await a character sequence, e.g., a function key.  The default   value, 1000 milliseconds, is enough for most uses.  However, it is   made a variable to accommodate unusual applications."  

Duh. It was taking exactly a full second.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Faves
  • LinkedIn
  • NewsVine
  • Technorati

Leave a Reply