NeoMutt  2025-12-11-79-gf03987
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
keymap.h
Go to the documentation of this file.
1
22
23#ifndef MUTT_KEY_KEYMAP_H
24#define MUTT_KEY_KEYMAP_H
25
26#include <stdbool.h>
27#include <stddef.h>
28#include "mutt/lib.h"
29
31typedef short keycode_t;
32
33extern struct Mapping KeyNames[];
34
42struct Keymap
43{
44 char *macro;
45 char *desc;
46 short op;
47 short eq;
48 short len;
51};
52STAILQ_HEAD(KeymapList, Keymap);
53
54struct Keymap *keymap_alloc (size_t len, keycode_t *keys);
55void keymap_free (struct Keymap **pptr);
56void keymaplist_free (struct KeymapList *kml);
57
58struct Keymap *keymap_compare (struct Keymap *km1, struct Keymap *km2, size_t *pos);
59bool keymap_expand_key (struct Keymap *km, struct Buffer *buf);
60void keymap_expand_string(const char *str, struct Buffer *buf);
61void keymap_get_name (int c, struct Buffer *buf);
62
63int parse_fkey (char *str);
64int parse_keycode (const char *str);
65size_t parse_keys (const char *str, keycode_t *d, size_t max);
66
67#endif /* MUTT_KEY_KEYMAP_H */
struct Mapping KeyNames[]
Key name lookup table.
Definition keymap.c:42
void keymap_get_name(int c, struct Buffer *buf)
Get the human name for a key.
Definition keymap.c:185
void keymaplist_free(struct KeymapList *kml)
Free a List of Keymaps.
Definition keymap.c:144
void keymap_expand_string(const char *str, struct Buffer *buf)
Get a human-readable key string.
Definition keymap.c:247
bool keymap_expand_key(struct Keymap *km, struct Buffer *buf)
Get the key string bound to a Keymap.
Definition keymap.c:229
void keymap_free(struct Keymap **pptr)
Free a Keymap.
Definition keymap.c:127
short keycode_t
Type for key storage, the rest of neomutt works fine with int type.
Definition keymap.h:31
struct Keymap * keymap_compare(struct Keymap *km1, struct Keymap *km2, size_t *pos)
Compare two keymaps' keyscodes and return the bigger one.
Definition keymap.c:162
size_t parse_keys(const char *str, keycode_t *d, size_t max)
Parse a key string into key codes.
Definition keymap.c:315
int parse_fkey(char *str)
Parse a function key string.
Definition keymap.c:263
struct Keymap * keymap_alloc(size_t len, keycode_t *keys)
Allocate space for a sequence of keys.
Definition keymap.c:112
int parse_keycode(const char *str)
Parse a numeric keycode.
Definition keymap.c:290
Convenience wrapper for the library headers.
#define STAILQ_HEAD(name, type)
Definition queue.h:312
String manipulation buffer.
Definition buffer.h:36
A keyboard mapping.
Definition keymap.h:43
keycode_t * keys
Key sequence.
Definition keymap.h:49
char * macro
Macro expansion (op == OP_MACRO)
Definition keymap.h:44
STAILQ_ENTRY(Keymap) entries
Linked list.
short eq
Number of leading keys equal to next entry.
Definition keymap.h:47
char * desc
Description of a macro for the help menu.
Definition keymap.h:45
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 user-readable string and a constant.
Definition mapping.h:33