From 76d6b04d53b428e999341bb9040fdc4836c629fa Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 11 Sep 2014 13:00:12 -0700 Subject: [PATCH] GUAC-792: Implement remaining C0 control codes. --- src/terminal/terminal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 735eb9df..4adc12d6 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1213,12 +1213,18 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed char data; - /* If valid control code, send it */ - if (keysym >= 'A' && keysym <= 'Z') - data = (char) (keysym - 'A' + 1); + /* Keysyms for '@' through '_' are all conveniently in C0 order */ + if (keysym >= '@' && keysym <= '_') + data = (char) (keysym - '@'); + + /* Handle lowercase as well */ else if (keysym >= 'a' && keysym <= 'z') data = (char) (keysym - 'a' + 1); + /* Ctrl+? is DEL (0x7f) */ + else if (keysym == '?') + data = 0x7F; + /* Otherwise ignore */ else return 0;