Set up a key binding.
Insert a key sequence into the specified map. The map is sorted by ASCII value (lowest to highest)
53{
56
58 struct Keymap *last = NULL;
60 struct Keymap *compare = NULL;
62 size_t pos = 0;
63 size_t lastpos = 0;
64
66 struct KeymapList *kml = &sm->
keymaps;
67
69
74
75
77 {
79
80 if (compare == map)
81 {
82 last = np;
83 lastpos = pos;
86 }
87 else if (compare == np)
88 {
90 break;
91 }
92 else
93 {
94
95 if ((np->
len !=
len) && (np->
op != OP_NULL))
96 {
97 static const char *guide_link = "https://neomutt.org/guide/configuration.html#bind-warnings";
98
101
104
105 char *err_msg =
_(
"Binding '%s' will alias '%s' Before, try: 'bind %s %s noop'");
106 if (err)
107 {
108
112 }
113 else
114 {
121 }
123
126 }
127
131 break;
132 }
133 }
134
135 if (last)
136 {
139 else
142 }
143 else
144 {
146 }
147
148 return rc;
149}
#define ARRAY_FIRST(head)
Convenience method to get the first element.
#define ARRAY_EMPTY(head)
Check if an array is empty.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
bool keymap_expand_key(struct Keymap *km, struct Buffer *buf)
Get the key string bound to a Keymap.
void keymap_free(struct Keymap **pptr)
Free a Keymap.
struct Keymap * keymap_compare(struct Keymap *km1, struct Keymap *km2, size_t *pos)
Compare two keymaps' keyscodes and return the bigger one.
size_t parse_keys(const char *str, keycode_t *d, size_t max)
Parse a key string into key codes.
struct Keymap * keymap_alloc(size_t len, keycode_t *keys)
Allocate space for a sequence of keys.
short keycode_t
Type for key storage, the rest of neomutt works fine with int type.
char * mutt_str_dup(const char *str)
Copy a string, safely.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
#define STAILQ_REMOVE(head, elm, type, field)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_INSERT_TAIL(head, elm, field)
#define STAILQ_INSERT_HEAD(head, elm, field)
#define STAILQ_NEXT(elm, field)
#define STAILQ_INSERT_AFTER(head, tqelm, elm, field)
String manipulation buffer.
char * macro
Macro expansion (op == OP_MACRO)
short eq
Number of leading keys equal to next entry.
char * desc
Description of a macro for the help menu.
short len
Length of key sequence (unit: sizeof (keycode_t))
short op
Operation to perform.