67 for (
int i = 0; funcs[i].
name; i++)
68 if (funcs[i].
op ==
op)
84static int print_macro(FILE *fp,
int maxwidth,
const char **macro)
90 mbstate_t mbstate1 = { 0 };
91 mbstate_t mbstate2 = { 0 };
93 for (; len && (k = mbrtowc(&wc, *macro, len, &mbstate1)); *macro += k, len -= k)
98 memset(&mbstate1, 0,
sizeof(mbstate1));
103 const int w = wcwidth(wc);
110 char buf[MB_LEN_MAX * 2];
119 else if ((wc < 0x20) || (wc == 0x7f))
133 fprintf(fp,
"^%c", (
char) ((wc +
'@') & 0x7f));
161 mbstate_t mbstate = { 0 };
163 for (m = wid, n = 0; len && (k = mbrtowc(&wc, s, len, &mbstate)) && (n <= wid);
171 memset(&mbstate, 0,
sizeof(mbstate));
195static int pad(FILE *fp,
int col,
int i)
199 char fmt[32] = { 0 };
200 snprintf(fmt,
sizeof(fmt),
"%%-%ds", i - col);
201 fprintf(fp, fmt,
"");
224static void format_line(FILE *fp,
int ismacro,
const char *t1,
const char *t2,
225 const char *t3,
int wraplen)
233 bool split = (wraplen < 40);
242 const int col_a = (wraplen > 83) ? (wraplen - 32) >> 2 : 12;
243 col_b = (wraplen > 49) ? (wraplen - 10) >> 1 : 19;
267 col =
pad(fp, col, col_b);
278 int n = wraplen - col;
302 col =
pad(fp, n, col_b);
318 struct Keymap *map = NULL;
319 char buf[128] = { 0 };
323 if (map->
op != OP_NULL)
327 if (map->
op == OP_MACRO)
339 _(
"ERROR: please report this bug"),
354 struct Keymap *map = NULL;
372 struct KeymapList *km_list,
struct KeymapList *aux,
int wraplen)
374 for (
int i = 0; funcs[i].
name; i++)
387 char banner[128] = { 0 };
397 desc =
_(
"<UNKNOWN>");
418 fprintf(fp,
"\n%s\n\n",
_(
"Generic bindings:"));
422 fprintf(fp,
"\n%s\n\n",
_(
"Unbound functions:"));
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
struct Buffer buf_make(size_t size)
Make a new buffer on the stack.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Convenience wrapper for the gui headers.
static void dump_unbound(FILE *fp, const struct MenuFuncOp *funcs, struct KeymapList *km_list, struct KeymapList *aux, int wraplen)
Write out all the operations with no key bindings.
static int pad(FILE *fp, int col, int i)
Write some padding to a file.
static bool is_bound(struct KeymapList *km_list, int op)
Does a function have a keybinding?
static void format_line(FILE *fp, int ismacro, const char *t1, const char *t2, const char *t3, int wraplen)
Write a formatted line to a file.
static int get_wrapped_width(const char *t, size_t wid)
Wrap a string at a sensible place.
static int print_macro(FILE *fp, int maxwidth, const char **macro)
Print a macro string to a file.
static void dump_menu(FILE *fp, enum MenuType menu, int wraplen)
Write all the key bindings to a file.
static const struct MenuFuncOp * help_lookup_function(int op, enum MenuType menu)
Find a keybinding for an operation.
void mutt_help(enum MenuType menu)
Display the help menu.
struct KeymapList Keymaps[MENU_MAX]
Array of key mappings, one for each MenuType.
int km_expand_key(char *s, size_t len, struct Keymap *map)
Get the key string bound to a Keymap.
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
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.
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.
All user-callable functions.
Prototypes for many functions.
#define STAILQ_FOREACH(var, head, field)
String manipulation buffer.
char * macro
macro expansion (op == OP_MACRO)
char * desc
description of a macro for the help menu
short op
operation to perform
struct WindowState state
Current state of the Window.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
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.