int LastKey; /**< contains the last key the user pressed */
struct Keymap *Keymaps[MENU_MAX];
+struct KeymapList *NewKeymaps[MENU_MAX];
/**
* alloc_keys - Allocate space for a sequence of keys
{
struct Keymap *p = mutt_mem_calloc(1, sizeof(struct Keymap));
p->len = len;
- p->keys = mutt_mem_malloc(len * sizeof(keycode_t));
+ p->keys = mutt_mem_calloc(len, sizeof(keycode_t));
memcpy(p->keys, keys, len * sizeof(keycode_t));
return p;
}
void km_init(void)
{
memset(Keymaps, 0, sizeof(struct Keymap *) * MENU_MAX);
+ memset(NewKeymaps, 0, sizeof(struct KeymapList *) * MENU_MAX);
create_bindings(OpAttach, MENU_ATTACH);
create_bindings(OpBrowser, MENU_FOLDER);
*/
struct Keymap
{
- char *macro; /**< macro expansion (op == OP_MACRO) */
- char *desc; /**< description of a macro for the help menu */
- struct Keymap *next; /**< next key in map */
- short op; /**< operation to perform */
- short eq; /**< number of leading keys equal to next entry */
- short len; /**< length of key sequence (unit: sizeof (keycode_t)) */
- keycode_t *keys; /**< key sequence */
+ char *macro; /**< macro expansion (op == OP_MACRO) */
+ char *desc; /**< description of a macro for the help menu */
+ struct Keymap *next; /**< next key in map */
+ short op; /**< operation to perform */
+ short eq; /**< number of leading keys equal to next entry */
+ short len; /**< length of key sequence (unit: sizeof (keycode_t)) */
+ keycode_t *keys; /**< key sequence */
+ STAILQ_ENTRY(Keymap) entries; /**< next key in map */
};
+STAILQ_HEAD(KeymapList, Keymap);
+
/**
* struct KeyEvent - An event such as a keypress
*/