key-binding: sort binding lists

Sort bindings such that bindings with the same symbol are sorted with
the binding having the most modifiers comes first.

This fixes an issue where the “wrong” key binding are triggered when
used with “consumed” modifiers.

For example: if Control+BackSpace is bound before
Control+Shift+BackSpace, then the latter binding is never triggered.

Why? Because Shift is a consumed modifier. This means
Control+BackSpace is “the same” as Control+Shift+BackSpace.

By sorting bindings with more modifiers first, we work around the
problem. But note that it is *just* a workaround, and I’m not
confident there aren’t cases where it doesn’t work.

Closes #1280
This commit is contained in:
Daniel Eklöf 2023-02-27 17:56:03 +01:00
parent 514fcc20a7
commit 9a5a2d9957
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 59 additions and 0 deletions

View file

@ -126,6 +126,8 @@
* Wayland protocol violation when ack:ing a configure event for an
unmapped surface ([#1249][1249]).
* `xdg\_toplevel::set_min_size()` not being called.
* Key bindings with consumed modifiers masking other key bindings
([#1280][1280]).
[1173]: https://codeberg.org/dnkl/foot/issues/1173
[1190]: https://codeberg.org/dnkl/foot/issues/1190
@ -135,6 +137,7 @@
[1259]: https://codeberg.org/dnkl/foot/issues/1259
[1256]: https://codeberg.org/dnkl/foot/issues/1256
[1249]: https://codeberg.org/dnkl/foot/issues/1249
[1280]: https://codeberg.org/dnkl/foot/issues/1280
### Security