From 0be6f18019e1a5f5765c2061f7d69436e5fdec57 Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Fri, 30 Nov 2012 16:34:47 +0000 Subject: Handle ANSI and DEC mode report CSIs --- demo.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'demo.c') 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); } } -- cgit v1.2.3