From 898b53bf16d0f42b95afb6441c37ac00677aeb99 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 7 Sep 2023 16:20:02 +0200 Subject: [PATCH] Workaround kitty F3 issue --- src/lib/in.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/in.c b/src/lib/in.c index b6d4c79ef..a56905452 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -956,6 +956,10 @@ kitty_cb_functional(inputctx* ictx){ unsigned val = amata_next_numeric(&ictx->amata, "\x1b[", ';'); unsigned mods = amata_next_numeric(&ictx->amata, "", ':'); unsigned ev = amata_next_numeric(&ictx->amata, "", '~'); + if(val == 13) { + kitty_kbd(ictx, NCKEY_F03, mods, ev); + return 23; + } uint32_t kval = kitty_functional(val); if(kval == val){ kval = legacy_functional(val); @@ -1018,6 +1022,13 @@ kitty_cb_f3(inputctx* ictx){ return 2; } +static int +kitty_cb_f3_alternate(inputctx* ictx){ + amata_next_numeric(&ictx->amata, "\x1b[", '~'); + kitty_kbd(ictx, NCKEY_F03, 1, 0); + return 2; +} + static int kitty_cb_f4(inputctx* ictx){ unsigned mods = amata_next_numeric(&ictx->amata, "\x1b[1;", ':'); @@ -1771,6 +1782,7 @@ build_cflow_automaton(inputctx* ictx){ // technically these must begin with "4" or "8"; enforce in callbacks { "[\\N;\\N;\\Nt", geom_cb, }, { "[\\Nu", kitty_cb_simple, }, + { "[13~", kitty_cb_f3_alternate, }, { "[\\N;\\N~", wezterm_cb, }, { "[\\N;\\Nu", kitty_cb, }, { "[\\N;\\N;\\Nu", kitty_cb_atxt1, }, @@ -2052,6 +2064,7 @@ prep_kitty_special_keys(inputctx* ictx){ { .esc = "\x1b[P", .key = NCKEY_F01, }, { .esc = "\x1b[Q", .key = NCKEY_F02, }, { .esc = "\x1b[R", .key = NCKEY_F03, }, + { .esc = "\x1b[13~", .key = NCKEY_F03, }, { .esc = "\x1b[S", .key = NCKEY_F04, }, { .esc = "\x1b[127;2u", .key = NCKEY_BACKSPACE, .modifiers = NCKEY_MOD_SHIFT, },