diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-11-30 16:34:47 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-11-30 16:34:47 +0000 |
commit | 0be6f18019e1a5f5765c2061f7d69436e5fdec57 (patch) | |
tree | e76d2840e4d04b851b8afdd2d019899b706bedda /termkey.c | |
parent | c00f6cd3c63e01c84220b607eccf5a2ba2df8f63 (diff) | |
download | termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.tar.gz termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.tar.xz termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.zip |
Handle ANSI and DEC mode report CSIs
Diffstat (limited to 'termkey.c')
-rw-r--r-- | termkey.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1254,6 +1254,15 @@ 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_MODEREPORT: + { + int initial, mode, value; + termkey_interpret_modereport(tk, key, &initial, &mode, &value); + if(initial) + l = snprintf(buffer + pos, len - pos, "Mode(%c%d=%d)", initial, mode, value); + else + l = snprintf(buffer + pos, len - pos, "Mode(%d=%d)", mode, value); + } case TERMKEY_TYPE_UNKNOWN_CSI: l = snprintf(buffer + pos, len - pos, "CSI %c", key->code.number & 0xff); break; @@ -1381,6 +1390,17 @@ int termkey_keycmp(TermKey *tk, const TermKeyKey *key1p, const TermKeyKey *key2p return col1 - col2; } break; + case TERMKEY_TYPE_MODEREPORT: + { + int initial1, initial2, mode1, mode2, value1, value2; + termkey_interpret_modereport(tk, &key1, &initial1, &mode1, &value1); + termkey_interpret_modereport(tk, &key2, &initial2, &mode2, &value2); + if(initial1 != initial2) + return initial1 - initial2; + if(mode1 != mode2) + return mode1 - mode2; + return value1 - value2; + } } return key1.modifiers - key2.modifiers; |