aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-02-08 20:21:17 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-02-16 22:02:25 +0000
commitcff097197f0e002636f982c70278dedf057256e9 (patch)
treeb7c0ac515a0f5cca28a616829b304f965d7cd58c
parenttests: config: initial tests for text-bindings (diff)
config: do key binding collision handling in overrides
This ensures we detect, and handle, collisions also for key-bindings specified as overrides.
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.c35
2 files changed, 19 insertions, 18 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab8d4b81..a385e3ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -72,6 +72,8 @@
* Exit code being 0 when a foot server with no open windows terminate
due to e.g. a Wayland connection failure
(https://codeberg.org/dnkl/foot/issues/943).
+* Key binding collisions not detected for bindings specified as option
+ overrides on the command line.
### Security
diff --git a/config.c b/config.c
index 99083130..f50ee685 100644
--- a/config.c
+++ b/config.c
@@ -3053,25 +3053,12 @@ config_load(struct config *conf, const char *conf_path,
goto out;
}
- ret = parse_config_file(f, conf, conf_file.path, errors_are_fatal) &&
- config_override_apply(conf, overrides, errors_are_fatal);
-
- if (ret &&
- (!resolve_key_binding_collisions(
- conf, section_info[SECTION_KEY_BINDINGS].name,
- binding_action_map, &conf->bindings.key, KEY_BINDING) ||
- !resolve_key_binding_collisions(
- conf, section_info[SECTION_SEARCH_BINDINGS].name,
- search_binding_action_map, &conf->bindings.search, KEY_BINDING) ||
- !resolve_key_binding_collisions(
- conf, section_info[SECTION_URL_BINDINGS].name,
- url_binding_action_map, &conf->bindings.url, KEY_BINDING) ||
- !resolve_key_binding_collisions(
- conf, section_info[SECTION_MOUSE_BINDINGS].name,
- binding_action_map, &conf->bindings.mouse, MOUSE_BINDING)))
+ if (!parse_config_file(f, conf, conf_file.path, errors_are_fatal) ||
+ !config_override_apply(conf, overrides, errors_are_fatal))
{
ret = !errors_are_fatal;
- }
+ } else
+ ret = true;
fclose(f);
@@ -3163,7 +3150,19 @@ config_override_apply(struct config *conf, config_override_t *overrides,
conf->csd.border_width = max(
min_csd_border_width, conf->csd.border_width_visible);
- return true;
+ return
+ resolve_key_binding_collisions(
+ conf, section_info[SECTION_KEY_BINDINGS].name,
+ binding_action_map, &conf->bindings.key, KEY_BINDING) &&
+ resolve_key_binding_collisions(
+ conf, section_info[SECTION_SEARCH_BINDINGS].name,
+ search_binding_action_map, &conf->bindings.search, KEY_BINDING) &&
+ resolve_key_binding_collisions(
+ conf, section_info[SECTION_URL_BINDINGS].name,
+ url_binding_action_map, &conf->bindings.url, KEY_BINDING) &&
+ resolve_key_binding_collisions(
+ conf, section_info[SECTION_MOUSE_BINDINGS].name,
+ binding_action_map, &conf->bindings.mouse, MOUSE_BINDING);
}
static void NOINLINE