From 927eaabae9406a154700e7a44b791f51e4757da5 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Wed, 12 Nov 2008 12:51:19 +0000 Subject: CSI driver shouldn't eat sequences it doesn't understand; leave them for another driver --- driver-csi.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/driver-csi.c b/driver-csi.c index 501e5d1..99ea5a7 100644 --- a/driver-csi.c +++ b/driver-csi.c @@ -206,8 +206,6 @@ static termkey_result getkey_csi(termkey_t *tk, termkey_csi *csi, size_t introle args++; - (*tk->method.eat_bytes)(tk, csi_end + 1); - if(args > 1 && arg[1] != -1) key->modifiers = arg[1] - 1; else @@ -230,8 +228,10 @@ static termkey_result getkey_csi(termkey_t *tk, termkey_csi *csi, size_t introle else key->code.sym = TERMKEY_SYM_UNKNOWN; - if(key->code.sym == TERMKEY_SYM_UNKNOWN) + if(key->code.sym == TERMKEY_SYM_UNKNOWN) { fprintf(stderr, "CSI function key %ld\n", arg[0]); + return TERMKEY_RES_NONE; + } } else { // We know from the logic above that cmd must be >= 0x40 and < 0x80 @@ -255,9 +255,12 @@ static termkey_result getkey_csi(termkey_t *tk, termkey_csi *csi, size_t introle fprintf(stderr, "CSI arg1=%ld arg2=%ld arg3=%ld ... args=%d cmd=%c\n", arg[0], arg[1], arg[2], args, cmd); break; } + return TERMKEY_RES_NONE; } } + (*tk->method.eat_bytes)(tk, csi_end + 1); + return TERMKEY_RES_KEY; } @@ -275,10 +278,8 @@ static termkey_result getkey_ss3(termkey_t *tk, termkey_csi *csi, size_t introle unsigned char cmd = CHARAT(introlen); - (*tk->method.eat_bytes)(tk, introlen + 1); - if(cmd < 0x40 || cmd >= 0x80) - return TERMKEY_SYM_UNKNOWN; + return TERMKEY_RES_NONE; key->type = csi->csi_ss3s[cmd - 0x40].type; key->code.sym = csi->csi_ss3s[cmd - 0x40].sym; @@ -292,17 +293,20 @@ static termkey_result getkey_ss3(termkey_t *tk, termkey_csi *csi, size_t introle key->utf8[0] = key->code.codepoint; key->utf8[1] = 0; - - return TERMKEY_RES_KEY; } - - key->type = csi->ss3s[cmd - 0x40].type; - key->code.sym = csi->ss3s[cmd - 0x40].sym; - key->modifiers = csi->ss3s[cmd - 0x40].modifier_set; + else { + key->type = csi->ss3s[cmd - 0x40].type; + key->code.sym = csi->ss3s[cmd - 0x40].sym; + key->modifiers = csi->ss3s[cmd - 0x40].modifier_set; + } } - if(key->code.sym == TERMKEY_SYM_UNKNOWN) + if(key->code.sym == TERMKEY_SYM_UNKNOWN) { fprintf(stderr, "SS3 %c (0x%02x)\n", cmd, cmd); + return TERMKEY_RES_NONE; + } + + (*tk->method.eat_bytes)(tk, introlen + 1); return TERMKEY_RES_KEY; } -- cgit v1.2.3-70-g09d2