Ncurses: Difference between revisions
escape sequences and terminfo |
|||
| Line 3: | Line 3: | ||
==Escape== | ==Escape== | ||
You can get Escape with no delay by using <tt>notimeout(3ncurses)</tt>, but this eliminates use of the function and arrow keys on terminals where those sequences are composed with Escape. You probably don't want that. You can use the ESCDELAY environment variable (see <tt>ncurses(3ncurses)</tt>) to change this (ncurses also provides a global of the same name). In a threaded environment, <tt>set_escdelay()</tt> ought be preferred. [[Vim]] uses a 25ms default. The ncurses default appears to be 1s (1000ms), which makes one's application feel kinda seasick when running on any reasonable connection (not to mention locally). This seems difficult to manipulate programaticly, though. :/ | You can get Escape with no delay by using <tt>notimeout(3ncurses)</tt>, but this eliminates use of the function and arrow keys on terminals where those sequences are composed with Escape. You probably don't want that. You can use the ESCDELAY environment variable (see <tt>ncurses(3ncurses)</tt>) to change this (ncurses also provides a global of the same name). In a threaded environment, <tt>set_escdelay()</tt> ought be preferred. [[Vim]] uses a 25ms default. The ncurses default appears to be 1s (1000ms), which makes one's application feel kinda seasick when running on any reasonable connection (not to mention locally). This seems difficult to manipulate programaticly, though. :/ | ||
===Escape codes=== | |||
The primary means of communicating with terminals is via escape sequences. The terminfo library, shipped with ncurses, allows these sequences to be looked up based off the terminal type (usually encoded in the environment variable <tt>TERM</tt>). The <tt>infocmp</tt> program dumps terminfo entries. Many terminals and terminal emulators support only some escape sequences, and they are not effectively standardized across terminals. Embedding hard-coded escape sequences into your program is a recipe for pain. | |||
The "termcap" library is obsolete, superseded entirely by terminfo, and ought not be used in new programs. | |||
==Colors== | ==Colors== | ||