From a2476536f9d28d8f02d8477822a1425df16ac28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 11 May 2026 09:16:30 +0200 Subject: [PATCH] search/url/unicode-mode: set last-shortcut-sym When processing shortcuts, set seat->kbd.last_shortcut_sym. This ensures the corresponding release event is ignored in the main mode, if the shortcut triggered a mode exit. For example, pressing Return in search mode would exit search mode, and then immediately reset the search match, if the kitty keyboard protocol mode with release events were enabled. --- search.c | 3 +++ unicode-mode.c | 2 ++ url-mode.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/search.c b/search.c index 5386ffd3..ef0a15bb 100644 --- a/search.c +++ b/search.c @@ -1433,6 +1433,7 @@ search_input(struct seat *seat, struct terminal *term, &update_search_result, &search_direction, &redraw)) { + seat->kbd.last_shortcut_sym = sym; goto update_search; } return; @@ -1451,6 +1452,7 @@ search_input(struct seat *seat, struct terminal *term, &update_search_result, &search_direction, &redraw)) { + seat->kbd.last_shortcut_sym = sym; goto update_search; } return; @@ -1470,6 +1472,7 @@ search_input(struct seat *seat, struct terminal *term, &update_search_result, &search_direction, &redraw)) { + seat->kbd.last_shortcut_sym = sym; goto update_search; } return; diff --git a/unicode-mode.c b/unicode-mode.c index 1acdc664..99a7293d 100644 --- a/unicode-mode.c +++ b/unicode-mode.c @@ -63,6 +63,7 @@ unicode_mode_input(struct seat *seat, struct terminal *term, term_to_slave(term, utf8, chars); } + seat->kbd.last_shortcut_sym = sym; unicode_mode_deactivate(term); } @@ -72,6 +73,7 @@ unicode_mode_input(struct seat *seat, struct terminal *term, sym == XKB_KEY_d || sym == XKB_KEY_g))) { + seat->kbd.last_shortcut_sym = sym; unicode_mode_deactivate(term); } diff --git a/url-mode.c b/url-mode.c index 44809f5f..45fdaf7a 100644 --- a/url-mode.c +++ b/url-mode.c @@ -204,6 +204,7 @@ urls_input(struct seat *seat, struct terminal *term, for (size_t i = 0; i < raw_count; i++) { if (bind->k.sym == raw_syms[i]) { execute_binding(seat, term, bind, serial); + seat->kbd.last_shortcut_sym = sym; return; } } @@ -217,6 +218,7 @@ urls_input(struct seat *seat, struct terminal *term, bind->mods == (mods & ~consumed)) { execute_binding(seat, term, bind, serial); + seat->kbd.last_shortcut_sym = sym; return; } @@ -232,6 +234,7 @@ urls_input(struct seat *seat, struct terminal *term, tll_foreach(bind->k.key_codes, code) { if (code->item == key) { execute_binding(seat, term, bind, serial); + seat->kbd.last_shortcut_sym = sym; return; } }