diff options
| author | CismonX <admin@cismon.net> | 2026-08-30 23:41:35 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2026-09-02 05:51:03 +0000 |
| commit | 1c4cfc2dfce5698411a552f056535f9a2fb2a6f6 (patch) | |
| tree | ed07e3290edf4252e81ebe5abe7f6135199d8f44 /config.c | |
| parent | config: fix error message for modifiers conflict (diff) | |
config: fix modifiers conflict check
Currently, if a mouse binding contains _any_ modifier key set in
config 'selection-override-modifiers', it does not work since
these modifiers get unset in function 'match_mouse_binding()'.
Function 'resolve_key_binding_collisions()' is supposed to detect
this and display an error message, however, it does not work unless
the conflicting modifiers are identical.
For example, given the following config options:
selection-override-modifiers=Control+Shift
select-begin-block=Control+BTN_LEFT
Foot does not display an error message for this, but if you try to
select text with 'Control+BTN_LEFT', it behaves as if only 'BTN_LEFT'
is pressed.
This is due to function 'modifiers_disjoint()' being implemented as
"not equal" rather than "disjoint".
Fixed by properly implementing this function. Also clarify the
'selection-override-modifiers' config option in the man page.
As a side effect, this also fixes 'selection-override-modifiers=none'
conflicting with mouse bindings that do not contain modifier keys
(an empty set is disjoint with itself).
Diffstat (limited to 'config.c')
| -rw-r--r-- | config.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -2230,7 +2230,25 @@ static bool modifiers_disjoint(const config_modifier_list_t *mods1, const config_modifier_list_t *mods2) { - return !modifiers_equal(mods1, mods2); + size_t count = 0; + tll_foreach(*mods1, it1) { + size_t skip = count; + tll_foreach(*mods2, it2) { + if (skip > 0) { + --skip; + continue; + } + + int r = strcmp(it1->item, it2->item); + if (r == 0) + return false; + if (r < 0) + break; + + ++count; + } + } + return true; } static char * NOINLINE |
