mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
key-bindings: try all bindings in translated mode before matching untranslated, and then finally raw
When trying to match key bindings, we do three types of matching: * Match the _translated_ symbol (e.g. Control+C) * Match the _untranslated_ symbol (e.g. Control+Shift+c) * Match raw keyboard codes This was done for *each* key binding. This meant we sometimes matched a keybinding in raw mode, even though there was a translated/untranslated binding that would match it too. All depending on the internal order of the key binding list. This patch changes it, so that we first try all bindings in translated mode, then all bindings in untranslated mode, and finally all bindings in raw mode. Closes #1929
This commit is contained in:
parent
7a5353d18a
commit
8d6f0d0583
4 changed files with 52 additions and 9 deletions
19
url-mode.c
19
url-mode.c
|
|
@ -178,11 +178,14 @@ urls_input(struct seat *seat, struct terminal *term,
|
|||
const xkb_keysym_t *raw_syms, size_t raw_count,
|
||||
uint32_t serial)
|
||||
{
|
||||
/* Key bindings */
|
||||
/*
|
||||
* Key bindings
|
||||
*/
|
||||
|
||||
/* Match translated symbol */
|
||||
tll_foreach(bindings->url, it) {
|
||||
const struct key_binding *bind = &it->item;
|
||||
|
||||
/* Match translated symbol */
|
||||
if (bind->k.sym == sym &&
|
||||
bind->mods == (mods & ~consumed))
|
||||
{
|
||||
|
|
@ -190,6 +193,11 @@ urls_input(struct seat *seat, struct terminal *term,
|
|||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Match untranslated symbols */
|
||||
tll_foreach(bindings->url, it) {
|
||||
const struct key_binding *bind = &it->item;
|
||||
if (bind->mods != mods)
|
||||
continue;
|
||||
|
||||
|
|
@ -199,6 +207,13 @@ urls_input(struct seat *seat, struct terminal *term,
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Match raw key code */
|
||||
tll_foreach(bindings->url, it) {
|
||||
const struct key_binding *bind = &it->item;
|
||||
if (bind->mods != mods)
|
||||
continue;
|
||||
|
||||
/* Match raw key code */
|
||||
tll_foreach(bind->k.key_codes, code) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue