69 fprintf(fp,
"bind %s %*s %*s # %s\n", menu_name, -wb0, bi->
a[0], -wb1,
128 fprintf(fp,
"macro %s %*s \"%s\" \"%s\"\n", menu_name, -wm0, bi->
a[0],
133 fprintf(fp,
"macro %s %*s \"%s\"\n", menu_name, -wm0, bi->
a[0], bi->
a[1]);
177 intptr_t data,
struct Buffer *err)
180 struct Buffer *tempfile = NULL;
181 bool dump_all =
false;
182 bool bind = (
data == 0);
234 buf_printf(err, bind ?
_(
"%s: no binds for this menu") :
_(
"%s: no macros for this menu"),
245 pview.
banner = bind ?
"bind" :
"macro";
287 mbstate_t mbstate1 = { 0 };
288 mbstate_t mbstate2 = { 0 };
290 for (; (len > 0) && (k = mbrtowc(&wc, macro, MB_LEN_MAX, &mbstate1)); macro += k, len -= k)
295 memset(&mbstate1, 0,
sizeof(mbstate1));
300 const int w = wcwidth(wc);
303 char tmp[MB_LEN_MAX * 2] = { 0 };
309 else if ((wc < 0x20) || (wc == 0x7f))
358 struct BindingInfoArray *bia_macro)
363 struct Keymap *map = NULL;
371 if (map->
op == OP_MACRO)
373 if (!bia_macro || (map->
op == OP_NULL))
388 if (map->
op == OP_NULL)
421 max_width =
MAX(max_width, col_width);
#define ARRAY_SORT(head, fn, sdata)
Sort an array.
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_EMPTY(head)
Check if an array is empty.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_FREE(head)
Release all memory.
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
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.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
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.
Convenience wrapper for the core headers.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
enum CommandResult dump_bind_macro(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'bind' and 'macro' commands - Implements Command::parse() -.
int binding_sort(const void *a, const void *b, void *sdata)
Compare two BindingInfo by their keybinding - Implements sort_t -.
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Convenience wrapper for the gui headers.
static void colon_macro(enum MenuType menu, FILE *fp)
Dump the macros.
int measure_column(struct BindingInfoArray *bia, int col)
Measure one column of a table.
static const char * help_lookup_function(int op, enum MenuType menu)
Find a keybinding for an operation.
void gather_menu(enum MenuType menu, struct BindingInfoArray *bia_bind, struct BindingInfoArray *bia_macro)
Gather info about one menu.
static void colon_bind(enum MenuType menu, FILE *fp)
Dump the key bindings.
static int print_bind(enum MenuType menu, FILE *fp)
Display the bindings for one menu.
static int print_macro(enum MenuType menu, FILE *fp)
Display the macros for one menu.
void escape_macro(const char *macro, struct Buffer *buf)
Escape any special characters in a macro.
struct KeymapList Keymaps[MENU_MAX]
Array of key mappings, one for each MenuType.
const char * mutt_get_func(const struct MenuFuncOp *funcs, int op)
Get the name of a function.
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
bool km_expand_key(struct Keymap *map, struct Buffer *buf)
Get the key string bound to a Keymap.
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
wchar_t ReplacementChar
When a Unicode character can't be displayed, use this instead.
#define ICONV_BUF_TOO_SMALL
Error value for iconv() - Buffer too small.
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
Convenience wrapper for the library headers.
int mutt_str_cmp(const char *a, const char *b)
Compare two strings, safely.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
const char * opcodes_get_description(int op)
Get the description of an opcode.
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_FOREACH(var, head, field)
Info about one keybinding.
const char * a[3]
Array of info.
String manipulation buffer.
char * data
Pointer to data.
char * macro
Macro expansion (op == OP_MACRO)
char * desc
Description of a macro for the help menu.
short op
Operation to perform.
const struct Mapping MenuNames[]
Menu name lookup table.
MenuType
Types of GUI selections.
@ MENU_GENERIC
Generic selection list.
@ MENU_PAGER
Pager pager (email viewer)
@ MENU_EDITOR
Text entry area.