From 3abeb81cb8ff5df92e1a4b176783591d7de9c675 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 26 Aug 2021 08:57:05 -0400 Subject: [PATCH] propagate early cursor report through interrogation #2094 --- src/lib/input.c | 4 ++-- src/lib/termdesc.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/input.c b/src/lib/input.c index a44e2b68a..150255c43 100644 --- a/src/lib/input.c +++ b/src/lib/input.c @@ -1623,8 +1623,8 @@ int ncinputlayer_init(tinfo* tcache, FILE* infp, queried_terminals_e* detected, .tcache = tcache, .state = STATE_NULL, .qterm = *detected, - .cursor_x = -1, - .cursor_y = -1, + .cursor_x = cursor_x ? *cursor_x + 1 : -1, + .cursor_y = cursor_y ? *cursor_y + 1 : -1, }; if(control_read(csifd, &inits)){ input_free_esctrie(&nilayer->inputescapes); diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index ef6ef115c..dc316301f 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -665,6 +665,14 @@ macos_early_matches(void){ int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned utf8, unsigned noaltscreen, unsigned nocbreak, unsigned nonewfonts, int* cursor_y, int* cursor_x, ncsharedstats* stats){ + int foolcursor_x, foolcursor_y; + if(!cursor_x){ + cursor_x = &foolcursor_x; + } + if(!cursor_y){ + cursor_y = &foolcursor_y; + } + *cursor_x = *cursor_y = -1; ti->qterm = TERMINAL_UNKNOWN; memset(ti, 0, sizeof(*ti)); // we don't need a controlling tty for everything we do; allow a failure here @@ -843,14 +851,6 @@ int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned ut } } unsigned appsync_advertised = 0; - int foolcursor_x, foolcursor_y; - if(!cursor_x){ - cursor_x = &foolcursor_x; - } - if(!cursor_y){ - cursor_y = &foolcursor_y; - } - *cursor_x = *cursor_y = -1; unsigned kittygraphs = 0; if(ncinputlayer_init(ti, stdin, &ti->qterm, &appsync_advertised, cursor_y, cursor_x, stats, &kittygraphs)){