summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-07-28 15:44:57 -0700
committerKevin McCarthy <kevin@8t8.us>2021-07-28 19:34:13 -0700
commit02298c190f6509762bd826a1aeeec43acd4c41da (patch)
tree8099ed50f648f0ae5e5ca54b648d8de01125aa4a
parent4021ab59f021abd84742ae36895158c7129cbb38 (diff)
Improve generic menu type handling.
Some of the menus are directly of MENU_GENERIC type. In a few places, Mutt handles those inefficiently or slightly incorrectly. Remove double "generic" lookups when Mutt is in a generic menu. Fix the help menu to not show unbound or "generic bindings" for a generic menu. For exec completion, always add generic functions to the possible completion list.
-rw-r--r--help.c6
-rw-r--r--init.c2
-rw-r--r--keymap.c8
3 files changed, 10 insertions, 6 deletions
diff --git a/help.c b/help.c
index 2dcfed1b..29dda797 100644
--- a/help.c
+++ b/help.c
@@ -36,7 +36,7 @@ static const struct menu_func_op_t *help_lookupFunction (int op, int menu)
int i;
const struct menu_func_op_t *map;
- if (menu != MENU_PAGER)
+ if (menu != MENU_PAGER && menu != MENU_GENERIC)
{
/* first look in the generic map for the function */
for (i = 0; OpGeneric[i].name; i++)
@@ -362,7 +362,7 @@ void mutt_help (int menu)
}
dump_menu (f, menu);
- if (menu != MENU_EDITOR && menu != MENU_PAGER)
+ if (menu != MENU_EDITOR && menu != MENU_PAGER && menu != MENU_GENERIC)
{
fputs (_("\nGeneric bindings:\n\n"), f);
dump_menu (f, MENU_GENERIC);
@@ -371,7 +371,7 @@ void mutt_help (int menu)
fputs (_("\nUnbound functions:\n\n"), f);
if (funcs)
dump_unbound (f, funcs, Keymaps[menu], NULL);
- if (menu != MENU_PAGER)
+ if (menu != MENU_EDITOR && menu != MENU_PAGER && menu != MENU_GENERIC)
dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]);
safe_fclose (&f);
diff --git a/init.c b/init.c
index ab2a3515..5dc6ac4b 100644
--- a/init.c
+++ b/init.c
@@ -3272,7 +3272,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
for (num = 0; menu[num].name; num++)
candidate (Completed, User_typed, menu[num].name, sizeof (Completed));
/* try the generic menu */
- if (Completed[0] == 0 && CurrentMenu != MENU_PAGER)
+ if (CurrentMenu != MENU_PAGER && CurrentMenu != MENU_GENERIC)
{
menu = OpGeneric;
for (num = 0; menu[num].name; num++)
diff --git a/keymap.c b/keymap.c
index e1cc5a75..ce5e48e2 100644
--- a/keymap.c
+++ b/keymap.c
@@ -499,7 +499,7 @@ int km_dokey (int menu)
if (menu == MENU_EDITOR && get_func (OpEditor, tmp.op))
return tmp.op;
- if (menu != MENU_EDITOR && menu != MENU_PAGER)
+ if (menu != MENU_EDITOR && menu != MENU_PAGER && menu != MENU_GENERIC)
{
/* check generic menu */
bindings = OpGeneric;
@@ -1090,8 +1090,12 @@ int mutt_parse_exec (BUFFER *buf, BUFFER *s, union pointer_long_t udata, BUFFER
bindings = OpGeneric;
ops[nops] = get_op (bindings, function, mutt_strlen(function));
- if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
+ if (ops[nops] == OP_NULL &&
+ CurrentMenu != MENU_PAGER &&
+ CurrentMenu != MENU_GENERIC)
+ {
ops[nops] = get_op (OpGeneric, function, mutt_strlen(function));
+ }
if (ops[nops] == OP_NULL)
{