From 52eee4482bf823455acd61617eba3a74702763d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 7 Dec 2021 21:52:43 +0100 Subject: [PATCH] =?UTF-8?q?kitty:=20when=20emitting=20associated=20text,?= =?UTF-8?q?=20don=E2=80=99t=20report=20mods/events=20unless=20necessary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- input.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/input.c b/input.c index 7587f729..e0587b17 100644 --- a/input.c +++ b/input.c @@ -1465,7 +1465,7 @@ emit_escapes: xassert(encoded_mods >= 1); char event[4]; - if (report_events) { + if (report_events /*&& !pressed*/) { /* Note: this deviates slightly from Kitty, which omits the * “:1” subparameter for key press events */ event[0] = ':'; @@ -1501,14 +1501,16 @@ emit_escapes: } } - if (encoded_mods > 1 || event[0] != '\0' || report_associated_text) { + bool emit_mods = encoded_mods > 1 || event[0] != '\0'; + + if (emit_mods) { bytes = snprintf(p, left, ";%u%s", encoded_mods, event); p += bytes; left -= bytes; + } - if (report_associated_text) { - bytes = snprintf(p, left, ";%u", utf32); - p += bytes; left -= bytes; - } + if (report_associated_text) { + bytes = snprintf(p, left, "%s;%u", !emit_mods ? ";" : "", utf32); + p += bytes; left -= bytes; } bytes = snprintf(p, left, "%c", final);