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.
This commit is contained in:
Daniel Eklöf 2026-05-11 09:16:30 +02:00
parent 43566b655f
commit a2476536f9
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 8 additions and 0 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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;
}
}