mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
config: remove replaced/removed key bindings, instead of marking as ‘unused’
Instead of keeping removed/replaced key bindings in the key binding array (marked as ‘unused’), remove them, by compacting the array. The invariant is thus that there should be *no* entries in the key binding list with the `BIND_ACTION_NONE` for action. Add code to debug builds that verifies this, plus a unit test. Closes #614
This commit is contained in:
parent
cf46acc68f
commit
149c52bd44
3 changed files with 134 additions and 32 deletions
6
input.c
6
input.c
|
|
@ -529,8 +529,6 @@ convert_key_bindings(const struct config *conf, struct seat *seat)
|
|||
{
|
||||
for (size_t i = 0; i < conf->bindings.key.count; i++) {
|
||||
const struct config_key_binding *binding = &conf->bindings.key.arr[i];
|
||||
if (binding->action == BIND_ACTION_NONE)
|
||||
continue;
|
||||
convert_key_binding(seat, binding, &seat->kbd.bindings.key);
|
||||
}
|
||||
}
|
||||
|
|
@ -540,8 +538,6 @@ convert_search_bindings(const struct config *conf, struct seat *seat)
|
|||
{
|
||||
for (size_t i = 0; i < conf->bindings.search.count; i++) {
|
||||
const struct config_key_binding *binding = &conf->bindings.search.arr[i];
|
||||
if (binding->action == BIND_ACTION_SEARCH_NONE)
|
||||
continue;
|
||||
convert_key_binding(seat, binding, &seat->kbd.bindings.search);
|
||||
}
|
||||
}
|
||||
|
|
@ -551,8 +547,6 @@ convert_url_bindings(const struct config *conf, struct seat *seat)
|
|||
{
|
||||
for (size_t i = 0; i < conf->bindings.url.count; i++) {
|
||||
const struct config_key_binding *binding = &conf->bindings.url.arr[i];
|
||||
if (binding->action == BIND_ACTION_URL_NONE)
|
||||
continue;
|
||||
convert_key_binding(seat, binding, &seat->kbd.bindings.url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue