aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-04-05 14:03:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-04-05 14:03:43 +0000
commit4ec2c598616f11a16548ec7b2cf8812050e04b26 (patch)
treebd262ab29720d1f3c296b797257c0d27101174d1
parentMerge branch 'sixel-fix-double-free-in-set-palette-size' (diff)
parentconfig: make {search,url}_binding_action_map[] function local (diff)
Merge branch 'fix-error-message-for-key-binding-collisions'
Closes #432
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.c70
-rw-r--r--doc/foot.ini.5.scd2
3 files changed, 38 insertions, 36 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16b5f9c3..970c070b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,8 @@
* Crash caused by a double free originating in `XTSMGRAPHICS` - set
number of color registers
(https://codeberg.org/dnkl/foot/issues/427).
+* Wrong action referenced in error message for key binding collisions
+ (https://codeberg.org/dnkl/foot/issues/432).
### Security
diff --git a/config.c b/config.c
index ab0236bb..6da5b68d 100644
--- a/config.c
+++ b/config.c
@@ -91,40 +91,6 @@ static const char *const binding_action_map[] = {
static_assert(ALEN(binding_action_map) == BIND_ACTION_COUNT,
"binding action map size mismatch");
-static const char *const search_binding_action_map[] = {
- [BIND_ACTION_SEARCH_NONE] = NULL,
- [BIND_ACTION_SEARCH_CANCEL] = "cancel",
- [BIND_ACTION_SEARCH_COMMIT] = "commit",
- [BIND_ACTION_SEARCH_FIND_PREV] = "find-prev",
- [BIND_ACTION_SEARCH_FIND_NEXT] = "find-next",
- [BIND_ACTION_SEARCH_EDIT_LEFT] = "cursor-left",
- [BIND_ACTION_SEARCH_EDIT_LEFT_WORD] = "cursor-left-word",
- [BIND_ACTION_SEARCH_EDIT_RIGHT] = "cursor-right",
- [BIND_ACTION_SEARCH_EDIT_RIGHT_WORD] = "cursor-right-word",
- [BIND_ACTION_SEARCH_EDIT_HOME] = "cursor-home",
- [BIND_ACTION_SEARCH_EDIT_END] = "cursor-end",
- [BIND_ACTION_SEARCH_DELETE_PREV] = "delete-prev",
- [BIND_ACTION_SEARCH_DELETE_PREV_WORD] = "delete-prev-word",
- [BIND_ACTION_SEARCH_DELETE_NEXT] = "delete-next",
- [BIND_ACTION_SEARCH_DELETE_NEXT_WORD] = "delete-next-word",
- [BIND_ACTION_SEARCH_EXTEND_WORD] = "extend-to-word-boundary",
- [BIND_ACTION_SEARCH_EXTEND_WORD_WS] = "extend-to-next-whitespace",
- [BIND_ACTION_SEARCH_CLIPBOARD_PASTE] = "clipboard-paste",
- [BIND_ACTION_SEARCH_PRIMARY_PASTE] = "primary-paste",
-};
-
-static_assert(ALEN(search_binding_action_map) == BIND_ACTION_SEARCH_COUNT,
- "search binding action map size mismatch");
-
-static const char *const url_binding_action_map[] = {
- [BIND_ACTION_URL_NONE] = NULL,
- [BIND_ACTION_URL_CANCEL] = "cancel",
- [BIND_ACTION_URL_TOGGLE_URL_ON_JUMP_LABEL] = "toggle-url-visible",
-};
-
-static_assert(ALEN(url_binding_action_map) == BIND_ACTION_URL_COUNT,
- "URL binding action map size mismatch");
-
#define LOG_AND_NOTIFY_ERR(...) \
do { \
LOG_ERR(__VA_ARGS__); \
@@ -1393,7 +1359,7 @@ parse_key_binding_section(
if (!parse_key_combos(
conf, value, &key_combos, section, key, path, lineno) ||
has_key_binding_collisions(
- conf, action, binding_action_map, bindings, &key_combos,
+ conf, action, action_map, bindings, &key_combos,
path, lineno))
{
free(pipe_argv);
@@ -1462,6 +1428,31 @@ parse_section_search_bindings(
const char *key, const char *value, struct config *conf,
const char *path, unsigned lineno)
{
+ static const char *const search_binding_action_map[] = {
+ [BIND_ACTION_SEARCH_NONE] = NULL,
+ [BIND_ACTION_SEARCH_CANCEL] = "cancel",
+ [BIND_ACTION_SEARCH_COMMIT] = "commit",
+ [BIND_ACTION_SEARCH_FIND_PREV] = "find-prev",
+ [BIND_ACTION_SEARCH_FIND_NEXT] = "find-next",
+ [BIND_ACTION_SEARCH_EDIT_LEFT] = "cursor-left",
+ [BIND_ACTION_SEARCH_EDIT_LEFT_WORD] = "cursor-left-word",
+ [BIND_ACTION_SEARCH_EDIT_RIGHT] = "cursor-right",
+ [BIND_ACTION_SEARCH_EDIT_RIGHT_WORD] = "cursor-right-word",
+ [BIND_ACTION_SEARCH_EDIT_HOME] = "cursor-home",
+ [BIND_ACTION_SEARCH_EDIT_END] = "cursor-end",
+ [BIND_ACTION_SEARCH_DELETE_PREV] = "delete-prev",
+ [BIND_ACTION_SEARCH_DELETE_PREV_WORD] = "delete-prev-word",
+ [BIND_ACTION_SEARCH_DELETE_NEXT] = "delete-next",
+ [BIND_ACTION_SEARCH_DELETE_NEXT_WORD] = "delete-next-word",
+ [BIND_ACTION_SEARCH_EXTEND_WORD] = "extend-to-word-boundary",
+ [BIND_ACTION_SEARCH_EXTEND_WORD_WS] = "extend-to-next-whitespace",
+ [BIND_ACTION_SEARCH_CLIPBOARD_PASTE] = "clipboard-paste",
+ [BIND_ACTION_SEARCH_PRIMARY_PASTE] = "primary-paste",
+ };
+
+ static_assert(ALEN(search_binding_action_map) == BIND_ACTION_SEARCH_COUNT,
+ "search binding action map size mismatch");
+
return parse_key_binding_section(
"search-bindings", key, value, BIND_ACTION_SEARCH_COUNT,
search_binding_action_map, &conf->bindings.search, conf, path, lineno);
@@ -1472,6 +1463,15 @@ parse_section_url_bindings(
const char *key, const char *value, struct config *conf,
const char *path, unsigned lineno)
{
+ static const char *const url_binding_action_map[] = {
+ [BIND_ACTION_URL_NONE] = NULL,
+ [BIND_ACTION_URL_CANCEL] = "cancel",
+ [BIND_ACTION_URL_TOGGLE_URL_ON_JUMP_LABEL] = "toggle-url-visible",
+ };
+
+ static_assert(ALEN(url_binding_action_map) == BIND_ACTION_URL_COUNT,
+ "URL binding action map size mismatch");
+
return parse_key_binding_section(
"url-bindings", key, value, BIND_ACTION_URL_COUNT,
url_binding_action_map, &conf->bindings.url, conf, path, lineno);
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index ac815b23..dcf644ef 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -593,7 +593,7 @@ scrollback search mode. The syntax is exactly the same as the regular
Deletes the **character after** the cursor. Default: _Delete_.
*delete-next-word*
- Deletes the **word after** the cursor. Default: _Mod1+b
+ Deletes the **word after** the cursor. Default: _Mod1+d
Control+Delete_.
*extend-to-word-boundary*