diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index 80b459b66..f37ebee1e 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -321,25 +321,22 @@ init_terminfo_esc(tinfo* ti, const char* name, escape_e idx, // request kitty keyboard protocol through level 1, first pushing current. // see https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement // FIXME go to level 11, but first need handle all functional keys -#define KBDSUPPORT "\x1b[>u\x1b[=1u" +#define KBDSUPPORT "\x1b[=1u" // the kitty keyboard protocol allows unambiguous, complete identification of // input events. this queries for the level of support. we want to do this // because the "keyboard pop" control code is mishandled by kitty < 0.20.0. #define KBDQUERY "\x1b[?u" -// Set modifyFunctionKeys (2) if supported, allowing us to disambiguate -// function keys when used with modifiers. Set modifyOtherKeys (4) if -// supported. +// set modifyFunctionKeys (2) if supported, allowing us to disambiguate +// function keys when used with modifiers. set modifyOtherKeys (4) if +// supported. these ought follow keyboard push and precede kitty keyboard. #define XTMODKEYS "\x1b[>2;1m\x1b[>4;1m" -// these queries (terminated with a Primary Device Attributes, to which -// all known terminals reply) hopefully can uniquely and unquestionably -// identify the terminal to which we are talking. -#define IDQUERIES KITTYQUERY \ - KBDSUPPORT \ - KBDQUERY \ - TRIDEVATTR \ +// these queries can hopefully uniquely and unquestionably identify the +// terminal to which we are talking. if we already know what we're talking +// to, there's no point in sending them. +#define IDQUERIES TRIDEVATTR \ XTVERSION \ XTGETTCAPTN \ SECDEVATTR @@ -373,8 +370,13 @@ init_terminfo_esc(tinfo* ti, const char* name, escape_e idx, #define DIRECTIVES CSI_BGQ \ SUMQUERY \ - XTMODKEYS \ "\x1b[?1;3;256S" /* try to set 256 cregs */ \ + KKEYBOARD_PUSH \ + XTMODKEYS \ + KITTYQUERY \ + XTMODKEYS \ + KBDSUPPORT \ + KBDQUERY \ CREGSXTSM \ GEOMXTSM \ GEOMPIXEL \ diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index ff5df0acf..18115c18d 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -16,7 +16,8 @@ extern "C" { #include "fbuf.h" #include "in.h" -#define KKEYBOARD_POP "\x1b[u" struct ncpile; struct sprixel;