|
From: | Thomas Dickey |
Subject: | Re: alt-arrow keys |
Date: | Wed, 12 Jul 2006 17:55:10 -0400 (EDT) |
On Wed, 12 Jul 2006, Pierre Abbat wrote:
I wrote a routine that returns an alt-key as a single code, equal to 0x00400000 plus the key, and returns a function key as a code equal to 0x00200000 plus whatever is returned with KEY_CODE_YES. (These are the next bits available after all Unicode planes are encoded.) So alt-A is 0x00400041, alt-Ы is 0x0040042b, and with keypad on, PgUp is 0x00200153 and up arrow is 0x00200103. However, Ctrl-uparrow, Alt-uparrow, and Ctrl-Alt-uparrow produce the following:
...
That is, the program is getting the sequence Esc[1;5A and ncurses apparently does not recognize that as a single keystroke. Can you fix it so that it does? Or is there some flag that I can set to enable these keys?
That's normally done by the terminfo entry. Alt is a modifier (does notnormally send a character or character sequence by itself). Common modifiers include shift, control and meta (which may be the same as alt).
Some terminals have an optional feature for prefixing an ESC before the normal character value in response to alt. If the keypad() mode is set true, (n)curses attempts to match the incoming characters against the known escape sequences. Anything that's not recognized is left as separate characters. (From the description it's not clear which way you have keypad() set to, or what $TERM you're using).
-- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net
[Prev in Thread] | Current Thread | [Next in Thread] |