Commit d03703c8 authored by Samuel Thibault's avatar Samuel Thibault Committed by Andrzej Zaborowski

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: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarAndrew Zaborowski <balrogg@gmail.com>
parent 633aa0ac
......@@ -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;
}
......
......@@ -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,
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment