diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-07-28 15:44:57 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-07-28 19:34:13 -0700 |
commit | 02298c190f6509762bd826a1aeeec43acd4c41da (patch) | |
tree | 8099ed50f648f0ae5e5ca54b648d8de01125aa4a | |
parent | 4021ab59f021abd84742ae36895158c7129cbb38 (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.c | 6 | ||||
-rw-r--r-- | init.c | 2 | ||||
-rw-r--r-- | keymap.c | 8 |
3 files changed, 10 insertions, 6 deletions
@@ -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); @@ -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++) @@ -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) { |