Fix Kitty key encoding: legacy fallback, F3, case, send-keys drop.

This commit is contained in:
Michael Grant
2026-09-29 07:23:45 +01:00
parent 25caebc173
commit cf7aad1ce8
4 changed files with 87 additions and 8 deletions

View File

@@ -485,6 +485,7 @@ input_key_vt10x(struct bufferevent *bev, key_code key)
struct utf8_data ud;
key_code onlykey;
const char *p;
int meta;
static const char *standard_map[2] = {
"1!9(0)=+;:'\",<.>/-8? 2",
"119900=+;;'',,..\x1f\x1f\x7f\x7f\0\0",
@@ -492,14 +493,20 @@ input_key_vt10x(struct bufferevent *bev, key_code key)
log_debug("%s: key in %llx", __func__, key);
if (key & KEYC_META)
input_key_write(__func__, bev, "\033", 1);
/*
* Remember whether Meta was set and write its ESC prefix only once
* the key below it is known to be encodable, so a key that turns
* out to fail does not leave a stray ESC in the pane.
*/
meta = !!(key & KEYC_META);
/*
* There's no way to report modifiers for unicode keys in standard mode
* so lose the modifiers.
*/
if (KEYC_IS_UNICODE(key)) {
if (meta)
input_key_write(__func__, bev, "\033", 1);
utf8_to_data(key, &ud);
input_key_write(__func__, bev, ud.data, ud.size);
return (0);
@@ -536,6 +543,8 @@ input_key_vt10x(struct bufferevent *bev, key_code key)
log_debug("%s: key out %llx", __func__, key);
if (meta)
input_key_write(__func__, bev, "\033", 1);
ud.data[0] = key & 0x7f;
input_key_write(__func__, bev, &ud.data[0], 1);
return (0);