mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-28 07:58:00 -04:00
Merge branch 'fix-error-message-for-key-binding-collisions'
Closes #432
This commit is contained in:
commit
4ec2c59861
3 changed files with 38 additions and 36 deletions
|
|
@ -37,6 +37,8 @@
|
||||||
* Crash caused by a double free originating in `XTSMGRAPHICS` - set
|
* Crash caused by a double free originating in `XTSMGRAPHICS` - set
|
||||||
number of color registers
|
number of color registers
|
||||||
(https://codeberg.org/dnkl/foot/issues/427).
|
(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
|
### Security
|
||||||
|
|
|
||||||
70
config.c
70
config.c
|
|
@ -91,40 +91,6 @@ static const char *const binding_action_map[] = {
|
||||||
static_assert(ALEN(binding_action_map) == BIND_ACTION_COUNT,
|
static_assert(ALEN(binding_action_map) == BIND_ACTION_COUNT,
|
||||||
"binding action map size mismatch");
|
"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(...) \
|
#define LOG_AND_NOTIFY_ERR(...) \
|
||||||
do { \
|
do { \
|
||||||
LOG_ERR(__VA_ARGS__); \
|
LOG_ERR(__VA_ARGS__); \
|
||||||
|
|
@ -1393,7 +1359,7 @@ parse_key_binding_section(
|
||||||
if (!parse_key_combos(
|
if (!parse_key_combos(
|
||||||
conf, value, &key_combos, section, key, path, lineno) ||
|
conf, value, &key_combos, section, key, path, lineno) ||
|
||||||
has_key_binding_collisions(
|
has_key_binding_collisions(
|
||||||
conf, action, binding_action_map, bindings, &key_combos,
|
conf, action, action_map, bindings, &key_combos,
|
||||||
path, lineno))
|
path, lineno))
|
||||||
{
|
{
|
||||||
free(pipe_argv);
|
free(pipe_argv);
|
||||||
|
|
@ -1462,6 +1428,31 @@ parse_section_search_bindings(
|
||||||
const char *key, const char *value, struct config *conf,
|
const char *key, const char *value, struct config *conf,
|
||||||
const char *path, unsigned lineno)
|
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(
|
return parse_key_binding_section(
|
||||||
"search-bindings", key, value, BIND_ACTION_SEARCH_COUNT,
|
"search-bindings", key, value, BIND_ACTION_SEARCH_COUNT,
|
||||||
search_binding_action_map, &conf->bindings.search, conf, path, lineno);
|
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 *key, const char *value, struct config *conf,
|
||||||
const char *path, unsigned lineno)
|
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(
|
return parse_key_binding_section(
|
||||||
"url-bindings", key, value, BIND_ACTION_URL_COUNT,
|
"url-bindings", key, value, BIND_ACTION_URL_COUNT,
|
||||||
url_binding_action_map, &conf->bindings.url, conf, path, lineno);
|
url_binding_action_map, &conf->bindings.url, conf, path, lineno);
|
||||||
|
|
|
||||||
|
|
@ -593,7 +593,7 @@ scrollback search mode. The syntax is exactly the same as the regular
|
||||||
Deletes the **character after** the cursor. Default: _Delete_.
|
Deletes the **character after** the cursor. Default: _Delete_.
|
||||||
|
|
||||||
*delete-next-word*
|
*delete-next-word*
|
||||||
Deletes the **word after** the cursor. Default: _Mod1+b
|
Deletes the **word after** the cursor. Default: _Mod1+d
|
||||||
Control+Delete_.
|
Control+Delete_.
|
||||||
|
|
||||||
*extend-to-word-boundary*
|
*extend-to-word-boundary*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue