diff mbox

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

Message ID 20101019174820.GA10718@const.famille.thibault.fr
State New
Headers show

Commit Message

Samuel Thibault Oct. 19, 2010, 5:48 p.m. UTC
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 <samuel.thibault@ens-lyon.org>

Comments

andrzej zaborowski Oct. 21, 2010, 4:26 p.m. UTC | #1
On 19 October 2010 19:48, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> 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
diff mbox

Patch

diff --git a/ui/curses.c b/ui/curses.c
index ed3165e..5d949d6 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -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;
             }
 
diff --git a/ui/curses_keys.h b/ui/curses_keys.h
index 1decd11..c0d5eb4 100644
--- a/ui/curses_keys.h
+++ b/ui/curses_keys.h
@@ -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,
 };