NeoMutt  2025-12-11-87-gae07fd
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
menu.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#include <string.h>
31#include "mutt/lib.h"
32#include "core/lib.h"
33#include "gui/lib.h"
34#include "menu.h"
35#include "lib.h"
36#include "init.h"
37#include "keymap.h"
38
45struct Keymap *km_find_func(enum MenuType mtype, int func)
46{
47 struct Keymap *np = NULL;
48 STAILQ_FOREACH(np, &Keymaps[mtype], entries)
49 {
50 if (np->op == func)
51 break;
52 }
53 return np;
54}
55
63int km_get_op(const struct MenuFuncOp *funcs, const char *start, size_t len)
64{
65 for (int i = 0; funcs[i].name; i++)
66 {
67 if (mutt_istrn_equal(start, funcs[i].name, len) && (mutt_str_len(funcs[i].name) == len))
68 {
69 return funcs[i].op;
70 }
71 }
72
73 return OP_NULL;
74}
75
82bool is_bound(const struct KeymapList *km_list, int op)
83{
84 if (!km_list)
85 return false;
86
87 struct Keymap *map = NULL;
88 STAILQ_FOREACH(map, km_list, entries)
89 {
90 if (map->op == op)
91 return true;
92 }
93
94 return false;
95}
Convenience wrapper for the core headers.
Convenience wrapper for the gui headers.
Set up the key bindings.
struct KeymapList Keymaps[MENU_MAX]
Array of key mappings, one for each MenuType.
Definition lib.c:56
Manage keymappings.
struct Keymap * km_find_func(enum MenuType mtype, int func)
Find a function's mapping in a Menu.
Definition menu.c:45
int km_get_op(const struct MenuFuncOp *funcs, const char *start, size_t len)
Get the function by its name.
Definition menu.c:63
bool is_bound(const struct KeymapList *km_list, int op)
Does a function have a keybinding?
Definition menu.c:82
Keymap handling.
Maniplate Menus and SubMenus.
Convenience wrapper for the library headers.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition string.c:500
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
Definition string.c:457
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
A keyboard mapping.
Definition keymap.h:43
short len
Length of key sequence (unit: sizeof (keycode_t))
Definition keymap.h:48
short op
Operation to perform.
Definition keymap.h:46
Mapping between a function and an operation.
Definition menu.h:37
const char * name
Name of the function.
Definition menu.h:38
int op
Operation, e.g. OP_DELETE.
Definition menu.h:39
MenuType
Types of GUI selections.
Definition type.h:35