NeoMutt  2022-04-29-215-gc12b98
Teaching an old dog new tricks
DOXYGEN
icommands.c
Go to the documentation of this file.
1
31#include "config.h"
32#include <limits.h>
33#include <stdbool.h>
34#include <stdio.h>
35#include "mutt/lib.h"
36#include "config/lib.h"
37#include "core/lib.h"
38#include "mutt.h"
39#include "icommands.h"
40#include "menu/lib.h"
41#include "pager/lib.h"
42#include "functions.h"
43#include "init.h"
44#include "keymap.h"
45#include "muttlib.h"
46#include "opcodes.h"
47#include "version.h"
48#ifdef USE_DEBUG_COLOR
49#include "gui/lib.h"
50#include "color/lib.h"
51#include "pager/private_data.h"
52#endif
53
54// clang-format off
55static enum CommandResult icmd_bind (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
56#ifdef USE_DEBUG_COLOR
57static enum CommandResult icmd_color (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
58#endif
59static enum CommandResult icmd_set (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
60static enum CommandResult icmd_version(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
61// clang-format on
62
68static const struct ICommand ICommandList[] = {
69 // clang-format off
70 { "bind", icmd_bind, 0 },
71#ifdef USE_DEBUG_COLOR
72 { "color", icmd_color, 0 },
73#endif
74 { "macro", icmd_bind, 1 },
75 { "set", icmd_set, 0 },
76 { "version", icmd_version, 0 },
77 { NULL, NULL, 0 },
78 // clang-format on
79};
80
91enum CommandResult mutt_parse_icommand(const char *line, struct Buffer *err)
92{
93 if (!line || (*line == '\0') || !err)
94 return MUTT_CMD_ERROR;
95
97
98 struct Buffer *token = mutt_buffer_pool_get();
99 struct Buffer expn = mutt_buffer_make(0);
100 mutt_buffer_addstr(&expn, line);
101 mutt_buffer_seek(&expn, 0);
102
104
105 SKIPWS(expn.dptr);
107 for (size_t i = 0; ICommandList[i].name; i++)
108 {
109 if (!mutt_str_equal(token->data, ICommandList[i].name))
110 continue;
111
112 rc = ICommandList[i].parse(token, &expn, ICommandList[i].data, err);
113 if (rc != MUTT_CMD_SUCCESS)
114 goto finish;
115
116 break; /* Continue with next command */
117 }
118
119finish:
121 mutt_buffer_dealloc(&expn);
122 return rc;
123}
124
131static void dump_bind(struct Buffer *buf, struct Mapping *menu, struct Keymap *map)
132{
133 char key_binding[32] = { 0 };
134 const char *fn_name = NULL;
135
136 km_expand_key(key_binding, sizeof(key_binding), map);
137 if (map->op == OP_NULL)
138 {
139 mutt_buffer_add_printf(buf, "bind %s %s noop\n", menu->name, key_binding);
140 return;
141 }
142
143 /* The pager and editor menus don't use the generic map,
144 * however for other menus try generic first. */
145 if ((menu->value != MENU_PAGER) && (menu->value != MENU_EDITOR) && (menu->value != MENU_GENERIC))
146 {
147 fn_name = mutt_get_func(OpGeneric, map->op);
148 }
149
150 /* if it's one of the menus above or generic doesn't find
151 * the function, try with its own menu. */
152 if (!fn_name)
153 {
154 const struct MenuFuncOp *funcs = km_get_table(menu->value);
155 if (!funcs)
156 return;
157
158 fn_name = mutt_get_func(funcs, map->op);
159 }
160
161 mutt_buffer_add_printf(buf, "bind %s %s %s\n", menu->name, key_binding, fn_name);
162}
163
170static void dump_macro(struct Buffer *buf, struct Mapping *menu, struct Keymap *map)
171{
172 char key_binding[MAX_SEQ] = { 0 };
173 km_expand_key(key_binding, MAX_SEQ, map);
174
175 struct Buffer tmp = mutt_buffer_make(0);
176 escape_string(&tmp, map->macro);
177
178 if (map->desc)
179 {
180 mutt_buffer_add_printf(buf, "macro %s %s \"%s\" \"%s\"\n", menu->name,
181 key_binding, tmp.data, map->desc);
182 }
183 else
184 {
185 mutt_buffer_add_printf(buf, "macro %s %s \"%s\"\n", menu->name, key_binding, tmp.data);
186 }
187
189}
190
199static bool dump_menu(struct Buffer *buf, struct Mapping *menu, bool bind)
200{
201 bool empty = true;
202 struct Keymap *map = NULL;
203
204 STAILQ_FOREACH(map, &Keymaps[menu->value], entries)
205 {
206 if (bind && (map->op != OP_MACRO))
207 {
208 empty = false;
209 dump_bind(buf, menu, map);
210 }
211 else if (!bind && (map->op == OP_MACRO))
212 {
213 empty = false;
214 dump_macro(buf, menu, map);
215 }
216 }
217
218 return empty;
219}
220
226static void dump_all_menus(struct Buffer *buf, bool bind)
227{
228 for (int i = 0; i < MENU_MAX; i++)
229 {
230 const char *menu_name = mutt_map_get_name(i, MenuNames);
231 struct Mapping menu = { menu_name, i };
232
233 const bool empty = dump_menu(buf, &menu, bind);
234
235 /* Add a new line for readability between menus. */
236 if (!empty && (i < (MENU_MAX - 1)))
237 mutt_buffer_addch(buf, '\n');
238 }
239}
240
244static enum CommandResult icmd_bind(struct Buffer *buf, struct Buffer *s,
245 intptr_t data, struct Buffer *err)
246{
247 FILE *fp_out = NULL;
248 char tempfile[PATH_MAX] = { 0 };
249 bool dump_all = false, bind = (data == 0);
250
251 if (!MoreArgs(s))
252 dump_all = true;
253 else
255
256 if (MoreArgs(s))
257 {
258 /* More arguments potentially means the user is using the
259 * ::command_t :bind command thus we delegate the task. */
260 return MUTT_CMD_ERROR;
261 }
262
263 struct Buffer filebuf = mutt_buffer_make(4096);
264 if (dump_all || mutt_istr_equal(buf->data, "all"))
265 {
266 dump_all_menus(&filebuf, bind);
267 }
268 else
269 {
270 const int menu_index = mutt_map_get_value(buf->data, MenuNames);
271 if (menu_index == -1)
272 {
273 // L10N: '%s' is the (misspelled) name of the menu, e.g. 'index' or 'pager'
274 mutt_buffer_printf(err, _("%s: no such menu"), buf->data);
275 mutt_buffer_dealloc(&filebuf);
276 return MUTT_CMD_ERROR;
277 }
278
279 struct Mapping menu = { buf->data, menu_index };
280 dump_menu(&filebuf, &menu, bind);
281 }
282
283 if (mutt_buffer_is_empty(&filebuf))
284 {
285 // L10N: '%s' is the name of the menu, e.g. 'index' or 'pager',
286 // it might also be 'all' when all menus are affected.
287 mutt_buffer_printf(err, bind ? _("%s: no binds for this menu") : _("%s: no macros for this menu"),
288 dump_all ? "all" : buf->data);
289 mutt_buffer_dealloc(&filebuf);
290 return MUTT_CMD_ERROR;
291 }
292
293 mutt_mktemp(tempfile, sizeof(tempfile));
294 fp_out = mutt_file_fopen(tempfile, "w");
295 if (!fp_out)
296 {
297 // L10N: '%s' is the file name of the temporary file
298 mutt_buffer_printf(err, _("Could not create temporary file %s"), tempfile);
299 mutt_buffer_dealloc(&filebuf);
300 return MUTT_CMD_ERROR;
301 }
302 fputs(filebuf.data, fp_out);
303
304 mutt_file_fclose(&fp_out);
305 mutt_buffer_dealloc(&filebuf);
306
307 struct PagerData pdata = { 0 };
308 struct PagerView pview = { &pdata };
309
310 pdata.fname = tempfile;
311
312 pview.banner = (bind) ? "bind" : "macro";
314 pview.mode = PAGER_MODE_OTHER;
315
316 mutt_do_pager(&pview, NULL);
317 return MUTT_CMD_SUCCESS;
318}
319
320#ifdef USE_DEBUG_COLOR
324static enum CommandResult icmd_color(struct Buffer *buf, struct Buffer *s,
325 intptr_t data, struct Buffer *err)
326{
327 if (MoreArgs(s))
328 return MUTT_CMD_ERROR;
329
330 FILE *fp_out = NULL;
331 char tempfile[PATH_MAX] = { 0 };
332 struct Buffer filebuf = mutt_buffer_make(4096);
333 char color_fg[32] = { 0 };
334 char color_bg[32] = { 0 };
335
336 mutt_mktemp(tempfile, sizeof(tempfile));
337 fp_out = mutt_file_fopen(tempfile, "w");
338 if (!fp_out)
339 {
340 // L10N: '%s' is the file name of the temporary file
341 mutt_buffer_printf(err, _("Could not create temporary file %s"), tempfile);
342 mutt_buffer_dealloc(&filebuf);
343 return MUTT_CMD_ERROR;
344 }
345
346 mutt_buffer_addstr(&filebuf, "# All Colours\n\n");
347 mutt_buffer_addstr(&filebuf, "# Simple Colours\n");
348 for (enum ColorId cid = MT_COLOR_NONE + 1; cid < MT_COLOR_MAX; cid++)
349 {
350 struct AttrColor *ac = simple_color_get(cid);
351 if (!ac)
352 continue;
353
354 struct CursesColor *cc = ac->curses_color;
355 if (!cc)
356 continue;
357
358 const char *name = mutt_map_get_name(cid, ColorFields);
359 if (!name)
360 continue;
361
362 const char *swatch = color_debug_log_color_attrs(cc->fg, cc->bg, ac->attrs);
363 mutt_buffer_add_printf(&filebuf, "color %-18s %-30s %-8s %-8s # %s\n", name,
365 color_debug_log_name(color_fg, sizeof(color_fg), cc->fg),
366 color_debug_log_name(color_bg, sizeof(color_bg), cc->bg), swatch);
367 }
368
369 if (NumQuotedColors > 0)
370 {
371 mutt_buffer_addstr(&filebuf, "\n# Quoted Colours\n");
372 for (int i = 0; i < NumQuotedColors; i++)
373 {
374 struct AttrColor *ac = quoted_colors_get(i);
375 if (!ac)
376 continue;
377
378 struct CursesColor *cc = ac->curses_color;
379 if (!cc)
380 continue;
381
382 const char *swatch = color_debug_log_color_attrs(cc->fg, cc->bg, ac->attrs);
383 mutt_buffer_add_printf(&filebuf, "color quoted%d %-30s %-8s %-8s # %s\n",
385 color_debug_log_name(color_fg, sizeof(color_fg), cc->fg),
386 color_debug_log_name(color_bg, sizeof(color_bg), cc->bg),
387 swatch);
388 }
389 }
390
391 static const int regex_lists[] = {
397 };
398
399 int rl_count = 0;
400 for (int i = 0; regex_lists[i]; i++)
401 {
402 struct RegexColorList *rcl = regex_colors_get_list(regex_lists[i]);
403 if (!STAILQ_EMPTY(rcl))
404 rl_count++;
405 }
406
407 if (rl_count > 0)
408 {
409 for (int i = 0; regex_lists[i]; i++)
410 {
411 struct RegexColorList *rcl = regex_colors_get_list(regex_lists[i]);
412 if (STAILQ_EMPTY(rcl))
413 continue;
414
415 const char *name = mutt_map_get_name(regex_lists[i], ColorFields);
416 if (!name)
417 continue;
418
419 mutt_buffer_add_printf(&filebuf, "\n# Regex Colour %s\n", name);
420
421 struct RegexColor *rc = NULL;
422 STAILQ_FOREACH(rc, rcl, entries)
423 {
424 struct AttrColor *ac = &rc->attr_color;
425 struct CursesColor *cc = ac->curses_color;
426 if (!cc)
427 continue;
428
429 const char *swatch = color_debug_log_color_attrs(cc->fg, cc->bg, ac->attrs);
430 mutt_buffer_add_printf(&filebuf, "color %-14s %-30s %-8s %-8s %-30s # %s\n",
432 color_debug_log_name(color_fg, sizeof(color_fg), cc->fg),
433 color_debug_log_name(color_bg, sizeof(color_bg), cc->bg),
434 rc->pattern, swatch);
435 }
436 }
437 }
438
439#ifdef USE_DEBUG_COLOR
441 {
442 mutt_buffer_addstr(&filebuf, "\n# Merged Colours\n");
443 struct AttrColor *ac = NULL;
444 TAILQ_FOREACH(ac, &MergedColors, entries)
445 {
446 struct CursesColor *cc = ac->curses_color;
447 if (!cc)
448 continue;
449
450 const char *swatch = color_debug_log_color_attrs(cc->fg, cc->bg, ac->attrs);
451 mutt_buffer_add_printf(&filebuf, "# %-30s %-8s %-8s # %s\n",
453 color_debug_log_name(color_fg, sizeof(color_fg), cc->fg),
454 color_debug_log_name(color_bg, sizeof(color_bg), cc->bg),
455 swatch);
456 }
457 }
458
459 struct MuttWindow *win = window_get_focus();
460 if (win && (win->type == WT_CUSTOM) && win->parent && (win->parent->type == WT_PAGER))
461 {
462 struct PagerPrivateData *priv = win->parent->wdata;
463 if (priv && !TAILQ_EMPTY(&priv->ansi_list))
464 {
465 mutt_buffer_addstr(&filebuf, "\n# Ansi Colours\n");
466 struct AttrColor *ac = NULL;
467 TAILQ_FOREACH(ac, &priv->ansi_list, entries)
468 {
469 struct CursesColor *cc = ac->curses_color;
470 if (!cc)
471 continue;
472
473 const char *swatch = color_debug_log_color_attrs(cc->fg, cc->bg, ac->attrs);
474 mutt_buffer_add_printf(&filebuf, "# %-30s %-8s %-8s # %s\n",
476 color_debug_log_name(color_fg, sizeof(color_fg), cc->fg),
477 color_debug_log_name(color_bg, sizeof(color_bg), cc->bg),
478 swatch);
479 }
480 }
481 }
482#endif
483
484 fputs(filebuf.data, fp_out);
485
486 mutt_file_fclose(&fp_out);
487 mutt_buffer_dealloc(&filebuf);
488
489 struct PagerData pdata = { 0 };
490 struct PagerView pview = { &pdata };
491
492 pdata.fname = tempfile;
493
494 pview.banner = "color";
495 pview.flags = MUTT_SHOWCOLOR;
496 pview.mode = PAGER_MODE_OTHER;
497
498 mutt_do_pager(&pview, NULL);
499 return MUTT_CMD_SUCCESS;
500}
501#endif
502
506static enum CommandResult icmd_set(struct Buffer *buf, struct Buffer *s,
507 intptr_t data, struct Buffer *err)
508{
509 const bool set = mutt_str_equal(s->data, "set");
510 const bool set_all = mutt_str_equal(s->data, "set all");
511
512 if (!set && !set_all)
513 return MUTT_CMD_ERROR;
514
515 char tempfile[PATH_MAX] = { 0 };
516 mutt_mktemp(tempfile, sizeof(tempfile));
517
518 FILE *fp_out = mutt_file_fopen(tempfile, "w");
519 if (!fp_out)
520 {
521 // L10N: '%s' is the file name of the temporary file
522 mutt_buffer_printf(err, _("Could not create temporary file %s"), tempfile);
523 return MUTT_CMD_ERROR;
524 }
525
526 if (set_all)
528 else
530
531 mutt_file_fclose(&fp_out);
532
533 struct PagerData pdata = { 0 };
534 struct PagerView pview = { &pdata };
535
536 pdata.fname = tempfile;
537
538 pview.banner = "set";
540 pview.mode = PAGER_MODE_OTHER;
541
542 mutt_do_pager(&pview, NULL);
543
544 return MUTT_CMD_SUCCESS;
545}
546
550static enum CommandResult icmd_version(struct Buffer *buf, struct Buffer *s,
551 intptr_t data, struct Buffer *err)
552{
553 char tempfile[PATH_MAX] = { 0 };
554 mutt_mktemp(tempfile, sizeof(tempfile));
555
556 FILE *fp_out = mutt_file_fopen(tempfile, "w");
557 if (!fp_out)
558 {
559 // L10N: '%s' is the file name of the temporary file
560 mutt_buffer_printf(err, _("Could not create temporary file %s"), tempfile);
561 return MUTT_CMD_ERROR;
562 }
563
564 print_version(fp_out);
565 mutt_file_fclose(&fp_out);
566
567 struct PagerData pdata = { 0 };
568 struct PagerView pview = { &pdata };
569
570 pdata.fname = tempfile;
571
572 pview.banner = "version";
574 pview.mode = PAGER_MODE_OTHER;
575
576 mutt_do_pager(&pview, NULL);
577 return MUTT_CMD_SUCCESS;
578}
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:67
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:260
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:309
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:248
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:233
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:211
void mutt_buffer_seek(struct Buffer *buf, size_t offset)
Set current read/write position to offset from beginning.
Definition: buffer.c:483
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:168
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:85
#define MoreArgs(buf)
Definition: buffer.h:40
Color and attribute parsing.
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a colour id.
Definition: regex.c:166
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:74
const struct Mapping ColorFields[]
Mapping of colour names to their IDs.
Definition: command.c:45
ColorId
List of all colored objects.
Definition: color.h:35
@ MT_COLOR_INDEX_AUTHOR
Index: author field (takes a pattern)
Definition: color.h:78
@ MT_COLOR_MAX
Definition: color.h:89
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition: color.h:48
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:71
@ MT_COLOR_NONE
Definition: color.h:36
@ MT_COLOR_INDEX_SUBJECT
Index: subject field (takes a pattern)
Definition: color.h:80
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition: color.h:39
@ MT_COLOR_INDEX_TAG
Index: tag field (g, takes a pattern)
Definition: color.h:81
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition: color.h:38
@ MT_COLOR_INDEX
Index: default colour (takes a pattern)
Definition: color.h:77
@ MT_COLOR_INDEX_FLAGS
Index: flags field (takes a pattern)
Definition: color.h:79
CommandResult
Error codes for command_t parse functions.
Definition: command.h:34
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition: command.h:37
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition: command.h:35
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
const char * color_debug_log_attrs_list(int attrs)
Get a string to represent some attributes in the log.
Definition: debug.c:150
const char * color_debug_log_name(char *buf, int buflen, int color)
Get a string to represent a colour name.
Definition: debug.c:181
const char * color_debug_log_color_attrs(int fg, int bg, int attrs)
Get a colourful string to represent a colour in the log.
Definition: debug.c:67
int mutt_do_pager(struct PagerView *pview, struct Email *e)
Display some page-able text to the user (help or attachment)
Definition: do_pager.c:123
size_t escape_string(struct Buffer *buf, const char *src)
Write a string to a buffer, escaping special characters.
Definition: dump.c:46
bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp)
Write all the config to a file.
Definition: dump.c:165
#define CS_DUMP_ONLY_CHANGED
Only show config that the user has changed.
Definition: dump.h:36
#define CS_DUMP_NO_FLAGS
No flags are set.
Definition: dump.h:35
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:618
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition: functions.c:288
Convenience wrapper for the gui headers.
static void dump_all_menus(struct Buffer *buf, bool bind)
Dumps all the binds or macros inside every menu.
Definition: icommands.c:226
static enum CommandResult icmd_set(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'set' command to display config - Implements ICommand::parse()
Definition: icommands.c:506
static enum CommandResult icmd_bind(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'bind' and 'macro' commands - Implements ICommand::parse()
Definition: icommands.c:244
static enum CommandResult icmd_version(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'version' command - Implements ICommand::parse()
Definition: icommands.c:550
enum CommandResult mutt_parse_icommand(const char *line, struct Buffer *err)
Parse an informational command.
Definition: icommands.c:91
static void dump_macro(struct Buffer *buf, struct Mapping *menu, struct Keymap *map)
Dump a macro map to a buffer.
Definition: icommands.c:170
static const struct ICommand ICommandList[]
All available informational commands.
Definition: icommands.c:68
static void dump_bind(struct Buffer *buf, struct Mapping *menu, struct Keymap *map)
Dump a bind map to a buffer.
Definition: icommands.c:131
static bool dump_menu(struct Buffer *buf, struct Mapping *menu, bool bind)
Dumps all the binds or macros maps of a menu into a buffer.
Definition: icommands.c:199
Information commands.
int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
Definition: init.c:273
Config/command parsing.
struct KeymapList Keymaps[MENU_MAX]
Array of Keymap keybindings, one for each Menu.
Definition: keymap.c:126
int km_expand_key(char *s, size_t len, struct Keymap *map)
Get the key string bound to a Keymap.
Definition: keymap.c:928
const char * mutt_get_func(const struct MenuFuncOp *funcs, int op)
Get the name of a function.
Definition: keymap.c:518
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
Definition: keymap.c:1230
Manage keymappings.
#define MAX_SEQ
Definition: keymap.h:36
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
Definition: mapping.c:85
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
GUI present the user with a selectable list.
struct AttrColorList MergedColors
Array of user colours.
Definition: merged.c:41
Convenience wrapper for the library headers.
#define _(a)
Definition: message.h:28
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:819
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:807
Many unsorted constants and some structs.
#define MUTT_TOKEN_NO_FLAGS
No flags are set.
Definition: mutt.h:67
#define PATH_MAX
Definition: mutt.h:40
struct MuttWindow * window_get_focus(void)
Get the currently focused Window.
Definition: mutt_window.c:643
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ WT_PAGER
A panel containing the Pager Window.
Definition: mutt_window.h:100
Some miscellaneous functions.
#define mutt_mktemp(buf, buflen)
Definition: muttlib.h:71
All user-callable functions.
GUI display a file/email/help in a viewport with paging.
#define MUTT_PAGER_NO_FLAGS
No flags are set.
Definition: lib.h:58
#define MUTT_SHOWCOLOR
Show characters in color otherwise don't show characters.
Definition: lib.h:60
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:139
Private state data for the Pager.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define STAILQ_EMPTY(head)
Definition: queue.h:348
#define TAILQ_EMPTY(head)
Definition: queue.h:721
struct AttrColor * quoted_colors_get(int q)
Return the color of a quote, cycling through the used quotes.
Definition: quoted.c:72
int NumQuotedColors
Number of colours for quoted email text.
Definition: quoted.c:38
Sidebar functions.
#define SKIPWS(ch)
Definition: string2.h:46
A curses colour and its attributes.
Definition: attr.h:35
int attrs
Text attributes, e.g. A_BOLD.
Definition: attr.h:37
struct CursesColor * curses_color
Underlying Curses colour.
Definition: attr.h:36
String manipulation buffer.
Definition: buffer.h:34
char * dptr
Current read/write position.
Definition: buffer.h:36
char * data
Pointer to data.
Definition: buffer.h:35
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
Colour in the ncurses palette.
Definition: curses2.h:38
uint32_t fg
Foreground colour.
Definition: curses2.h:41
uint32_t bg
Background colour.
Definition: curses2.h:42
An Informational Command.
Definition: icommands.h:36
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Function to parse information commands.
Definition: icommands.h:47
char * name
Name of the command.
Definition: icommands.h:37
A keyboard mapping.
Definition: keymap.h:49
char * macro
macro expansion (op == OP_MACRO)
Definition: keymap.h:50
char * desc
description of a macro for the help menu
Definition: keymap.h:51
short op
operation to perform
Definition: keymap.h:52
Mapping between user-readable string and a constant.
Definition: mapping.h:32
int value
Integer value.
Definition: mapping.h:34
const char * name
String value.
Definition: mapping.h:33
Mapping between a function and an operation.
Definition: keymap.h:92
void * wdata
Private data.
Definition: mutt_window.h:145
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
Data to be displayed by PagerView.
Definition: lib.h:158
const char * fname
Name of the file to read.
Definition: lib.h:162
Private state data for the Pager.
Definition: private_data.h:41
struct AttrColorList ansi_list
List of ANSI colours used in the Pager.
Definition: private_data.h:70
Paged view into some data.
Definition: lib.h:169
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:170
enum PagerMode mode
Pager mode.
Definition: lib.h:171
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:172
const char * banner
Title to display in status bar.
Definition: lib.h:173
A regular expression and a color to highlight a line.
Definition: regex4.h:37
struct AttrColor attr_color
Colour and attributes to apply.
Definition: regex4.h:38
char * pattern
Pattern to match.
Definition: regex4.h:39
const struct Mapping MenuNames[]
Menu name lookup table.
Definition: type.c:31
@ MENU_GENERIC
Generic selection list.
Definition: type.h:45
@ MENU_PAGER
Pager pager (email viewer)
Definition: type.h:54
@ MENU_MAX
Definition: type.h:59
@ MENU_EDITOR
Text entry area.
Definition: type.h:43
bool print_version(FILE *fp)
Print system and compile info to a file.
Definition: version.c:408
Display version and copyright about NeoMutt.