mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
kitty: when emitting associated text, don’t report mods/events unless necessary
This commit is contained in:
parent
c0cfec89e0
commit
52eee4482b
1 changed files with 8 additions and 6 deletions
14
input.c
14
input.c
|
|
@ -1465,7 +1465,7 @@ emit_escapes:
|
||||||
xassert(encoded_mods >= 1);
|
xassert(encoded_mods >= 1);
|
||||||
|
|
||||||
char event[4];
|
char event[4];
|
||||||
if (report_events) {
|
if (report_events /*&& !pressed*/) {
|
||||||
/* Note: this deviates slightly from Kitty, which omits the
|
/* Note: this deviates slightly from Kitty, which omits the
|
||||||
* “:1” subparameter for key press events */
|
* “:1” subparameter for key press events */
|
||||||
event[0] = ':';
|
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);
|
bytes = snprintf(p, left, ";%u%s", encoded_mods, event);
|
||||||
p += bytes; left -= bytes;
|
p += bytes; left -= bytes;
|
||||||
|
}
|
||||||
|
|
||||||
if (report_associated_text) {
|
if (report_associated_text) {
|
||||||
bytes = snprintf(p, left, ";%u", utf32);
|
bytes = snprintf(p, left, "%s;%u", !emit_mods ? ";" : "", utf32);
|
||||||
p += bytes; left -= bytes;
|
p += bytes; left -= bytes;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = snprintf(p, left, "%c", final);
|
bytes = snprintf(p, left, "%c", final);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue