From 5c03486f86e32a0ca735bfb06cebd32f4ecd19e2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 10 Apr 2021 01:10:33 +0200 Subject: Fix cursor pos report and update interactive test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- interactive-test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'interactive-test.c') diff --git a/interactive-test.c b/interactive-test.c index 57bb20c..1eb3531 100644 --- a/interactive-test.c +++ b/interactive-test.c @@ -42,6 +42,10 @@ main(void) fprintf(stderr, "LIBTERMINPUT_ESC_ON_BLOCK set\n"); libterminput_set_flags(&ctx, LIBTERMINPUT_ESC_ON_BLOCK); } + if (getenv("TEST_LIBTERMINPUT_AWAITING_CURSOR_POSITION")) { + fprintf(stderr, "LIBTERMINPUT_AWAITING_CURSOR_POSITION set\n"); + libterminput_set_flags(&ctx, LIBTERMINPUT_AWAITING_CURSOR_POSITION); + } if (tcgetattr(STDERR_FILENO, &stty)) { perror("tcgetattr STDERR_FILENO"); @@ -167,6 +171,14 @@ main(void) printf("\033[1;4;4;10;10T"); fflush(stdout); } + } else if (input.type == LIBTERMINPUT_TERMINAL_IS_OK) { + printf("terminal ok\n"); + } else if (input.type == LIBTERMINPUT_TERMINAL_IS_NOT_OK) { + printf("terminal not ok\n"); + } else if (input.type == LIBTERMINPUT_CURSOR_POSITION) { + printf("cursor position:\n"); + printf("\tx: %zu\n", input.position.x); + printf("\ty: %zu\n", input.position.y); } else { printf("other\n"); } -- cgit v1.2.3-70-g09d2