diff --git a/src/lib/input.c b/src/lib/input.c index 36d829e46..5677565f5 100644 --- a/src/lib/input.c +++ b/src/lib/input.c @@ -752,7 +752,7 @@ stash_string(init_state* inits){ // ought be fed to the machine, and -1 on an invalid state transition. static int pump_control_read(init_state* inits, unsigned char c){ -//fprintf(stderr, "state: %2d char: %1c %3d %02x\n", inits->state, isprint(c) ? c : ' ', c, c); +fprintf(stderr, "state: %2d char: %1c %3d %02x\n", inits->state, isprint(c) ? c : ' ', c, c); if(c == NCKEY_ESC){ /*if(inits->state != STATE_NULL && inits->state != STATE_DCS && inits->state != STATE_DCS_DRAIN && inits->state != STATE_XTVERSION2 && inits->state != STATE_XTGETTCAP3 && inits->state != STATE_DA_DRAIN){ fprintf(stderr, "Unexpected escape in state %d\n", inits->state); diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index 36ffcdf60..2a3827b45 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -214,13 +214,24 @@ init_terminfo_esc(tinfo* ti, const char* name, escape_e idx, // ⇒ CSI ? 6 4 ; Ps c ("VT420") #define ESC_DA "\e[c" +// query background, replies in X color https://www.x.org/releases/X11R7.7/doc/man/man7/X.7.xhtml#heading11 +#define CSI_BGQ "\e]11;?\e\\\\\\" + // we send an XTSMGRAPHICS to set up 256 color registers (the most we can // currently take advantage of; we need at least 64 to use sixel at all. // maybe that works, maybe it doesn't. then query both color registers // and geometry. send XTGETTCAP for terminal name. static int send_initial_queries(int fd){ - const char queries[] = "\x1b[=0c\x1b[>c\x1b[>q\x1bP+q544e\x1b\\\x1b[?1;3;256S\x1b[?2;1;0S\x1b[?1;1;0S" ESC_DA; + const char queries[] = CSI_BGQ + "\x1b[=0c" + "\x1b[>c" + "\x1b[>q" + "\x1bP+q544e\x1b\\" + "\x1b[?1;3;256S" + "\x1b[?2;1;0S" + "\x1b[?1;1;0S" + ESC_DA; if(blocking_write(fd, queries, strlen(queries))){ return -1; }