Path: utzoo!utgpu!watserv1!watmath!att!att!bu.edu!rpi!zaphod.mps.ohio-state.edu!samsung!olivea!orc!inews!iwarp.intel.com!gargoyle!igloo!ddsw1!obdient!vpnet!akcs.dgy From: akcs.dgy@vpnet.chi.il.us (Donald Yuniskis) Newsgroups: comp.lang.c Subject: Trouble with curses Message-ID: <272b7f4c-5ea.1comp.lang.c-1@vpnet.chi.il.us> Date: 29 Oct 90 02:55:03 GMT References: <1990Oct27.173826.29771@NCoast.ORG> Lines: 18 >Basically what is happening is the the user presses ESCAPE key follow by >'E' key to exit. But I have to press 'E' twice after pressing ESCAPE >to get an exit. I can't figure out why. Does anybody know ? most "magic buttons" (function keys, etc) send an escape sequence. curses tries to build these escape sequences into special "KEY_" (see curses.h) codes to make you life easier (:->). to do this, when an ESC is received, curses starts a nominal one second timer. if other keys come in before this timer expires, curses tries to combine them into a recognized escape sequence which is then reduced to a "KEY_" constant and propagated through the getch() mechanism. Presumably, this process only is acive when you have enabled keypad() mode. Suggestions: try a pause after the ESC to verify this is the mechanism which is hosing you. A work around is to use a "non-escape" sequence (the ESC key is frowned upon even tho' _everyone_ uses it!) or, try to find a "KEY_" code which may be supported by the variety of terminals you intend to support and code _that_ as the "ESC e" you are trying to use (if ((ch = getch()) == KEY_?????) ....) also, may wish to explicitly disable keypad() mode... (are we having fun yet??)