On Sat, 3 Apr 2010, Michael Elkins wrote:
On Sat, Apr 03, 2010 at 09:36:44PM -0400, Thomas Dickey wrote:On Sun, 4 Apr 2010, Mutt wrote:The problem is that the ncurses library doesn't have a keycode for ctrl+<UP> or ctrl+<DOWN>. Instead you get a multibyte escape sequence.That's an extension (mutt could in principle ask ncurses for the binding of kUP5 and kDN5). Use "infocmp -x" to see some of the possibilities.Can you explain in a little more detail how this is supposed to work? It was not clear to me which of the following would be true: 1) there is some way to make getch() return a KEY_ constant for ctrl-<UP> 2) mutt would have to query the termcap entry for kUP5 and internally convert a user's specification of "\c<up>" to the kUP5 sequence.
Briefly:several of the terminfo entries in ncurses have "extended" capabilities defined. These are names not in the predefined table of booleans, numbers, strings. When a terminfo entry is compiled, ncurses determines from the syntax which type to use.
A convention is used for xterm and related entries (including rxvt) which uses a mixed-case name with a numeric suffix (based on xterm's modifier codes). It's been in use for several years, and "should" be available on multiple platforms.
An application can use these by a tigetstr to check existence, e.g., char *s; s = tigetstr("kDC6"); if (s != 0 && (long)(s) != -1) { /* use the value */ }ncurses decides that any of these strings that begin with "k" are (by convention...) key names, and if
use_extended_names(TRUE);was called, adds them to the table that getch uses to decode keys. ncurses generates a keycode for these extended strings, and will return that number.
An application can make its own list of these keycodes by using key_defined() for the by-convention names kDN6, kUP5, etc. The keyname() function also can be used, on the value from getch(), to get the name of the key.
-- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net