NeoMutt  2025-12-11-980-ge38c27
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
23
42
43#include "config.h"
44#include <stddef.h>
45#include "mutt/lib.h"
46#include "core/lib.h"
47#include "key/lib.h"
48#include "menu/lib.h"
49#include "module_data.h"
50#include "opcodes.h"
51
52// clang-format off
56static const struct MenuFuncOp OpGeneric[] = { /* map: generic */
57 /*
58 ** <para>
59 ** The <emphasis>generic</emphasis> menu is not a real menu, but specifies common functions
60 ** (such as movement) available in all menus except for <emphasis>pager</emphasis> and
61 ** <emphasis>editor</emphasis>. Changing settings for this menu will affect the default
62 ** bindings for all menus (except as noted).
63 ** </para>
64 */
65 { "bottom-page", OP_BOTTOM_PAGE },
66 { "check-stats", OP_CHECK_STATS },
67 { "current-bottom", OP_CURRENT_BOTTOM },
68 { "current-middle", OP_CURRENT_MIDDLE },
69 { "current-top", OP_CURRENT_TOP },
70 { "end-cond", OP_END_COND },
71 { "enter-command", OP_ENTER_COMMAND },
72 { "exit", OP_EXIT },
73 { "first-entry", OP_FIRST_ENTRY },
74 { "forget-passphrase", OP_FORGET_PASSPHRASE },
75 { "half-down", OP_HALF_DOWN },
76 { "half-up", OP_HALF_UP },
77 { "help", OP_HELP },
78 { "jump", OP_JUMP },
79 { "last-entry", OP_LAST_ENTRY },
80 { "middle-page", OP_MIDDLE_PAGE },
81 { "next-entry", OP_NEXT_ENTRY },
82 { "next-line", OP_NEXT_LINE },
83 { "next-page", OP_NEXT_PAGE },
84 { "previous-entry", OP_PREV_ENTRY },
85 { "previous-line", OP_PREV_LINE },
86 { "previous-page", OP_PREV_PAGE },
87 { "quit", OP_QUIT },
88 { "redraw-screen", OP_REDRAW },
89 { "search", OP_SEARCH },
90 { "search-next", OP_SEARCH_NEXT },
91 { "search-opposite", OP_SEARCH_OPPOSITE },
92 { "search-reverse", OP_SEARCH_REVERSE },
93 { "select-entry", OP_GENERIC_SELECT_ENTRY },
94 { "shell-escape", OP_SHELL_ESCAPE },
95 { "show-log-messages", OP_SHOW_LOG_MESSAGES },
96 { "show-version", OP_VERSION },
97 { "tag-entry", OP_TAG },
98 { "tag-prefix", OP_TAG_PREFIX },
99 { "tag-prefix-cond", OP_TAG_PREFIX_COND },
100 { "top-page", OP_TOP_PAGE },
101 { "what-key", OP_WHAT_KEY },
102 // Deprecated
103 { "error-history", OP_SHOW_LOG_MESSAGES, MFF_DEPRECATED },
104 { "refresh", OP_REDRAW, MFF_DEPRECATED },
105 { NULL, 0 },
106};
107
111static const struct MenuOpSeq GenericDefaultBindings[] = { /* map: generic */
112 { OP_BOTTOM_PAGE, "L" },
113 { OP_ENTER_COMMAND, ":" },
114 { OP_FIRST_ENTRY, "<home>" },
115 { OP_FIRST_ENTRY, "=" },
116 { OP_GENERIC_SELECT_ENTRY, "<keypadenter>" },
117 { OP_GENERIC_SELECT_ENTRY, "\n" }, // <Enter>
118 { OP_GENERIC_SELECT_ENTRY, "\r" }, // <Return>
119 { OP_HALF_DOWN, "]" },
120 { OP_HALF_UP, "[" },
121 { OP_HELP, "?" },
122 { OP_LAST_ENTRY, "*" },
123 { OP_LAST_ENTRY, "<end>" },
124 { OP_MIDDLE_PAGE, "M" },
125 { OP_NEXT_ENTRY, "<down>" },
126 { OP_NEXT_ENTRY, "j" },
127 { OP_NEXT_LINE, ">" },
128 { OP_NEXT_PAGE, "<pagedown>" },
129 { OP_NEXT_PAGE, "<right>" },
130 { OP_NEXT_PAGE, "z" },
131 { OP_PREV_ENTRY, "<up>" },
132 { OP_PREV_ENTRY, "k" },
133 { OP_PREV_LINE, "<" },
134 { OP_PREV_PAGE, "<left>" },
135 { OP_PREV_PAGE, "<pageup>" },
136 { OP_PREV_PAGE, "Z" },
137 { OP_QUIT, "q" },
138 { OP_REDRAW, "\014" }, // <Ctrl-L>
139 { OP_SEARCH, "/" },
140 { OP_SEARCH_NEXT, "n" },
141 { OP_SEARCH_REVERSE, "\033/" }, // <Alt-/>
142 { OP_SHELL_ESCAPE, "!" },
143 { OP_TAG, "t" },
144 { OP_TAG_PREFIX, ";" },
145 { OP_TOP_PAGE, "H" },
146 { OP_VERSION, "V" },
147 { 0, NULL },
148};
149// clang-format on
150
155{
157 ASSERT(mod_data);
158
159 struct MenuDefinition *md = NULL;
160 struct SubMenu *sm = NULL;
161
163 md = km_register_menu(MENU_GENERIC, "generic");
164 km_menu_add_submenu(md, sm);
166
167 mod_data->md_generic = md;
168 mod_data->sm_generic = sm;
169
170 return sm;
171}
172
178{
180 ASSERT(mod_data);
181
182 return mod_data->md_generic;
183}
Convenience wrapper for the core headers.
@ MFF_DEPRECATED
Function is deprecated.
Definition get.h:67
static const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition functions.c:56
struct SubMenu * generic_init_keys(struct NeoMutt *n)
Initialise the Generic Keybindings.
Definition functions.c:154
static const struct MenuOpSeq GenericDefaultBindings[]
Key bindings for the Generic Menu.
Definition functions.c:111
struct MenuDefinition * generic_get_menu_definition(void)
Get the Generic Menu Definition.
Definition functions.c:177
Gui private Module data.
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
Definition init.c:123
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
Definition init.c:88
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
Definition init.c:105
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
Definition init.c:136
Manage keymappings.
GUI present the user with a selectable list.
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
Convenience wrapper for the library headers.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:666
All user-callable functions.
#define ASSERT(COND)
Definition signal2.h:59
Gui private Module data.
Definition module_data.h:32
struct SubMenu * sm_generic
Generic functions.
Definition module_data.h:35
struct MenuDefinition * md_generic
Generic Menu Definition.
Definition module_data.h:34
Functions for a Dialog or Window.
Definition menudef.h:44
Mapping between a function and an operation.
Definition menu.h:37
Mapping between an operation and a key sequence.
Definition menu.h:47
Container for Accounts, Notifications.
Definition neomutt.h:41
Collection of related functions.
Definition menudef.h:33
@ MENU_GENERIC
Generic selection list.
Definition type.h:44