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 <[email protected]>
ui/curses.c +6 -3
@@ -238,9 +240,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; }
ui/curses_keys.h +1 -0
@@ -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, };
Hello,
This apparently has been neither applied, nor commented on. Could either be done?
Samuel
control-{@[\]^_} shouldn't get the 'a' - 'A' offset for correct translation. ESC is better simulated as escape key.
Signed-off-by Samuel Thibault <[email protected]>
ui/curses.c +6 -3
@@ -238,9 +240,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; }
ui/curses_keys.h +1 -0
@@ -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, };
Quoted 4 lines · Samuel Thibault
Hello,
This apparently has been neither applied, nor commented on. Could either be done?
Thanks, pushed the patch and sorry for missing the email the first time.
Cheers