aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2026-05-11 07:16:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-05-12 14:39:17 +0000
commita2476536f9d28d8f02d8477822a1425df16ac28d (patch)
treeca3ffcacc85095b04ca616bc02a24dfac330195b
parenturi: check 'scheme' is non-null before de-referencing it (diff)
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.
-rw-r--r--search.c3
-rw-r--r--unicode-mode.c2
-rw-r--r--url-mode.c3
3 files changed, 8 insertions, 0 deletions
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;
}
}