aboutsummaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 16:34:47 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 16:34:47 +0000
commit0be6f18019e1a5f5765c2061f7d69436e5fdec57 (patch)
treee76d2840e4d04b851b8afdd2d019899b706bedda /demo.c
parentc00f6cd3c63e01c84220b607eccf5a2ba2df8f63 (diff)
downloadtermo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.tar.gz
termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.tar.xz
termo-0be6f18019e1a5f5765c2061f7d69436e5fdec57.zip
Handle ANSI and DEC mode report CSIs
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/demo.c b/demo.c
index 2cd8ebc..7d697cd 100644
--- a/demo.c
+++ b/demo.c
@@ -68,6 +68,18 @@ int main(int argc, char *argv[])
termkey_interpret_position(tk, &key, &line, &col);
printf("Cursor position report at line=%d, col=%d\n", line, col);
}
+ else if(key.type == TERMKEY_TYPE_MODEREPORT) {
+ int initial, mode, value;
+ termkey_interpret_modereport(tk, &key, &initial, &mode, &value);
+ printf("Mode report %s mode %d = %d\n", initial ? "DEC" : "ANSI", mode, value);
+ }
+ else if(key.type == TERMKEY_TYPE_UNKNOWN_CSI) {
+ long args[16];
+ size_t nargs = 16;
+ unsigned long command;
+ termkey_interpret_csi(tk, &key, args, &nargs, &command);
+ printf("Unrecognised CSI %c %ld;%ld %c%c\n", (char)(command >> 8), args[0], args[1], (char)(command >> 16), (char)command);
+ }
else {
printf("%s\n", buffer);
}
@@ -80,7 +92,8 @@ int main(int argc, char *argv[])
if(key.type == TERMKEY_TYPE_UNICODE &&
key.modifiers == 0 &&
key.code.codepoint == '?') {
- printf("\033[?6n");
+ // printf("\033[?6n"); // DECDSR 6 == request cursor position
+ printf("\033[?1$p"); // DECRQM == request mode, DEC origin mode
fflush(stdout);
}
}