aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-07 20:52:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-12-08 17:06:08 +0000
commit30a66996b2dc57406311bb140d0aa988bcd19488 (patch)
treec5e9acb45f0bf2fe4c46384603f803a1bcb85804
parentkitty: report-alternate: apply base-layout key to composed characters (diff)
kitty: when emitting associated text, don’t report mods/events unless necessary
-rw-r--r--input.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/input.c b/input.c
index 661e881e..4ced612a 100644
--- a/input.c
+++ b/input.c
@@ -1460,7 +1460,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] = ':';
@@ -1496,14 +1496,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);