curses: Fix control-{@[\]^_} and ESC

control-{@[\]^_} shouldn't get the 'a' - 'A' offset for correct
translation. ESC is better simulated as escape key.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Andrew Zaborowski <balrogg@gmail.com>
This commit is contained in:
Samuel Thibault 2010-10-19 19:48:20 +02:00 committed by Andrzej Zaborowski
parent 633aa0acfe
commit d03703c81a
2 changed files with 7 additions and 3 deletions

View file

@ -238,9 +238,12 @@ static void curses_refresh(DisplayState *ds)
keysym = curses2keysym[chr];
if (keysym == -1) {
if (chr < ' ')
keysym = (chr + '@' - 'A' + 'a') | KEYSYM_CNTRL;
else
if (chr < ' ') {
keysym = chr + '@';
if (keysym >= 'A' && keysym <= 'Z')
keysym += 'a' - 'A';
keysym |= KEYSYM_CNTRL;
} else
keysym = chr;
}

View file

@ -55,6 +55,7 @@ static const int curses2keysym[CURSES_KEYS] = {
[0x7f] = KEY_BACKSPACE,
['\r'] = KEY_ENTER,
['\n'] = KEY_ENTER,
[27] = 27,
[KEY_BTAB] = '\t' | KEYSYM_SHIFT,
};