diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-11-30 14:35:23 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-11-30 14:35:23 +0000 |
commit | 7b3dc4be71e9c611bc4a6b191264f99eb642d44c (patch) | |
tree | 19aea2fd55a00f6d0fbaf252e327bc2b6850eea5 /termkey.c | |
parent | d241d6216abcf3607a72e53b18f2d0b5882bb164 (diff) | |
download | termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.tar.gz termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.tar.xz termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.zip |
Return a real key type for unrecognised CSI sequences; allow accessing them by termkey_interpret_csi()
Diffstat (limited to 'termkey.c')
-rw-r--r-- | termkey.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -189,6 +189,7 @@ static TermKey *termkey_alloc(void) tk->buffstart = 0; tk->buffcount = 0; tk->buffsize = 256; /* bytes */ + tk->hightide = 0; tk->restore_termios_valid = 0; @@ -744,6 +745,12 @@ static TermKeyResult peekkey(TermKey *tk, TermKeyKey *key, int force, size_t *nb fprintf(stderr, "\n"); #endif + if(tk->hightide) { + tk->buffstart += tk->hightide; + tk->buffcount -= tk->hightide; + tk->hightide = 0; + } + TermKeyResult ret; struct TermKeyDriverNode *p; for(p = tk->drivers; p; p = p->next) { @@ -1310,6 +1317,9 @@ size_t termkey_strfkey(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, T case TERMKEY_TYPE_POSITION: l = snprintf(buffer + pos, len - pos, "Position"); break; + case TERMKEY_TYPE_UNKNOWN_CSI: + l = snprintf(buffer + pos, len - pos, "CSI %c", key->code.number & 0xff); + break; } if(l <= 0) return pos; @@ -1413,6 +1423,7 @@ int termkey_keycmp(TermKey *tk, const TermKeyKey *key1p, const TermKeyKey *key2p return key1.code.sym - key2.code.sym; break; case TERMKEY_TYPE_FUNCTION: + case TERMKEY_TYPE_UNKNOWN_CSI: if(key1.code.number != key2.code.number) return key1.code.number - key2.code.number; break; |