59 mbstate_t mbstate1 = { 0 };
60 mbstate_t mbstate2 = { 0 };
62 for (; (len > 0) && (k = mbrtowc(&wc, macro, MB_LEN_MAX, &mbstate1)); macro += k, len -= k)
67 memset(&mbstate1, 0,
sizeof(mbstate1));
72 const int w = wcwidth(wc);
75 char tmp[MB_LEN_MAX * 2] = { 0 };
81 else if ((wc < 0x20) || (wc == 0x7f))
135 struct BindingInfoArray *bia_macro,
bool one_submenu)
147 struct BindingInfo bi_label = { ARRAY_FOREACH_IDX_smp, { NULL, NULL, name } };
154 struct Keymap *map = NULL;
157 struct BindingInfo bi = { ARRAY_FOREACH_IDX_smp, { NULL, NULL, NULL } };
162 if (map->
op == OP_MACRO)
164 if (!bia_macro || (map->
op == OP_NULL))
179 if (map->
op == OP_NULL)
237 max_width =
MAX(max_width, col_width);
261 const char *menu_name = md->
name;
269 fprintf(fp,
"bind %s %*s %*s # %s\n", menu_name, -wb0, bi->
a[0], -wb1,
326 const char *menu_name = md->
name;
336 fprintf(fp,
"macro %s %*s \"%s\" \"%s\"\n", menu_name, -wm0, bi->
a[0],
341 fprintf(fp,
"macro %s %*s \"%s\"\n", menu_name, -wm0, bi->
a[0], bi->
a[1]);
392 bool dump_all = (md == NULL);
413 buf_printf(err, (cmd->
id ==
CMD_BIND) ?
_(
"%s: no binds for this menu") :
_(
"%s: no macros for this menu"),
#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".
Convenience wrapper for the config headers.
#define mutt_numeric_cmp(a, b)
Compare two numbers, return -1, 0, or 1.
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)
#define MFF_DEPRECATED
Redraw the pager.
int binding_sort(const void *a, const void *b, void *sdata)
Compare two BindingInfo by their keybinding - Implements sort_t -.
Convenience wrapper for the gui headers.
void colon_macro(const struct MenuDefinition *md, FILE *fp)
Dump the macros.
int measure_column(struct BindingInfoArray *bia, int col)
Measure one column of a table.
void dump_bind_macro(const struct Command *cmd, const struct MenuDefinition *md, struct Buffer *buf, struct Buffer *err)
Dump a Menu's binds or macros to the Pager.
void gather_menu(const struct MenuDefinition *md, struct BindingInfoArray *bia_bind, struct BindingInfoArray *bia_macro, bool one_submenu)
Gather info about one menu.
struct StringArray km_get_func_array(const struct MenuDefinition *md)
Get array of function names for a Menu.
void escape_macro(const char *macro, struct Buffer *buf)
Escape any special characters in a macro.
const char * help_lookup_function(const struct MenuDefinition *md, int op)
Find a keybinding for an operation.
int gather_unbound(const struct MenuDefinition *md, struct BindingInfoArray *bia_unbound)
Gather info about unbound functions for one menu.
int print_bind(const struct MenuDefinition *md, FILE *fp)
Display the bindings for one menu.
void colon_bind(const struct MenuDefinition *md, FILE *fp)
Dump the key bindings.
int print_macro(const struct MenuDefinition *md, FILE *fp)
Display the macros for one menu.
bool keymap_expand_key(struct Keymap *km, struct Buffer *buf)
Get the key string bound to a Keymap.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MAX(a, b)
Return the maximum of two values.
@ MODULE_ID_KEY
ModuleKey, Key mappings
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.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
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.
int order
SubMenu sorting order.
String manipulation buffer.
const char * name
Name of the Command.
enum CommandId id
ID of the Command.
struct MenuDefinitionArray menu_defs
All registered Menus.
char * macro
Macro expansion (op == OP_MACRO)
char * desc
Description of a macro for the help menu.
short op
Operation to perform.
Container for Accounts, Notifications.