diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-02-10 18:19:43 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-02-10 18:19:43 +0000 |
commit | f76b62a65a51f0b8f65a8e9cee513c0b80f060b6 (patch) | |
tree | df6732897c992adca81dbcc538f7c81b9e65a98f | |
parent | fd15f3012077a1bcaa683657a6b3dad38d9b4c7b (diff) | |
download | termo-f76b62a65a51f0b8f65a8e9cee513c0b80f060b6.tar.gz termo-f76b62a65a51f0b8f65a8e9cee513c0b80f060b6.tar.xz termo-f76b62a65a51f0b8f65a8e9cee513c0b80f060b6.zip |
Interpret XTerm's CSI 27 ~ as modified generic key, report keypresses as appropriate
-rw-r--r-- | termkey.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -310,8 +310,14 @@ static termkey_result getkey_csi(termkey_t *tk, size_t introlen, termkey_key *ke eatbytes(tk, csi_end + 1); + key->modifiers = 0; + key->flags = TERMKEY_KEYFLAG_SPECIAL; + if(cmd == '~') { - if(arg[0] >= 0 && arg[0] < tk->ncsifuncs) + if(arg[0] == 27) { + do_codepoint(tk, arg[2], key); + } + else if(arg[0] >= 0 && arg[0] < tk->ncsifuncs) key->code = tk->csifuncs[arg[0]]; else key->code = TERMKEY_SYM_UNKNOWN; @@ -327,8 +333,8 @@ static termkey_result getkey_csi(termkey_t *tk, size_t introlen, termkey_key *ke fprintf(stderr, "CSI arg1=%d arg2=%d cmd=%c\n", arg[0], arg[1], cmd); } - key->modifiers = (args > 1 && arg[1] != -1) ? arg[1] - 1 : 0; - key->flags = TERMKEY_KEYFLAG_SPECIAL; + if(args > 1 && arg[1] != -1) + key->modifiers |= arg[1] - 1; return TERMKEY_RES_KEY; } |