NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
command.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stddef.h>
31#include <stdbool.h>
32#include <stdint.h>
33#include <stdlib.h>
34#include "mutt/lib.h"
35#include "core/lib.h"
36#include "gui/lib.h" // IWYU pragma: keep
37#include "mutt.h"
38#include "lib.h"
39#include "init.h"
40#include "options.h"
41
45const struct Mapping ColorFields[] = {
46 // clang-format off
47 { "attachment", MT_COLOR_ATTACHMENT },
48 { "attach_headers", MT_COLOR_ATTACH_HEADERS },
49 { "body", MT_COLOR_BODY },
50 { "bold", MT_COLOR_BOLD },
51 { "error", MT_COLOR_ERROR },
52 { "hdrdefault", MT_COLOR_HDRDEFAULT },
53 { "header", MT_COLOR_HEADER },
54 { "index", MT_COLOR_INDEX },
55 { "index_author", MT_COLOR_INDEX_AUTHOR },
56 { "index_collapsed", MT_COLOR_INDEX_COLLAPSED },
57 { "index_date", MT_COLOR_INDEX_DATE },
58 { "index_flags", MT_COLOR_INDEX_FLAGS },
59 { "index_label", MT_COLOR_INDEX_LABEL },
60 { "index_number", MT_COLOR_INDEX_NUMBER },
61 { "index_size", MT_COLOR_INDEX_SIZE },
62 { "index_subject", MT_COLOR_INDEX_SUBJECT },
63 { "index_tag", MT_COLOR_INDEX_TAG },
64 { "index_tags", MT_COLOR_INDEX_TAGS },
65 { "indicator", MT_COLOR_INDICATOR },
66 { "italic", MT_COLOR_ITALIC },
67 { "markers", MT_COLOR_MARKERS },
68 { "message", MT_COLOR_MESSAGE },
69 { "normal", MT_COLOR_NORMAL },
70 { "options", MT_COLOR_OPTIONS },
71 { "progress", MT_COLOR_PROGRESS },
72 { "prompt", MT_COLOR_PROMPT },
73 { "quoted", MT_COLOR_QUOTED },
74 { "search", MT_COLOR_SEARCH },
75#ifdef USE_SIDEBAR
76 { "sidebar_divider", MT_COLOR_SIDEBAR_DIVIDER },
77 { "sidebar_flagged", MT_COLOR_SIDEBAR_FLAGGED },
78 { "sidebar_highlight", MT_COLOR_SIDEBAR_HIGHLIGHT },
79 { "sidebar_indicator", MT_COLOR_SIDEBAR_INDICATOR },
80 { "sidebar_new", MT_COLOR_SIDEBAR_NEW },
81 { "sidebar_ordinary", MT_COLOR_SIDEBAR_ORDINARY },
82 { "sidebar_spool_file", MT_COLOR_SIDEBAR_SPOOLFILE },
83 { "sidebar_spoolfile", MT_COLOR_SIDEBAR_SPOOLFILE }, // This will be deprecated
84 { "sidebar_unread", MT_COLOR_SIDEBAR_UNREAD },
85#endif
86 { "signature", MT_COLOR_SIGNATURE },
87 { "status", MT_COLOR_STATUS },
88 { "tilde", MT_COLOR_TILDE },
89 { "tree", MT_COLOR_TREE },
90 { "underline", MT_COLOR_UNDERLINE },
91 { "warning", MT_COLOR_WARNING },
92 { NULL, 0 },
93 // clang-format on
94};
95
99const struct Mapping ComposeColorFields[] = {
100 // clang-format off
101 { "header", MT_COLOR_COMPOSE_HEADER },
102 { "security_encrypt", MT_COLOR_COMPOSE_SECURITY_ENCRYPT },
103 { "security_sign", MT_COLOR_COMPOSE_SECURITY_SIGN },
104 { "security_both", MT_COLOR_COMPOSE_SECURITY_BOTH },
105 { "security_none", MT_COLOR_COMPOSE_SECURITY_NONE },
106 { NULL, 0 }
107 // clang-format on
108};
109
121static enum CommandResult parse_color_name(const char *s, uint32_t *col, int *attrs,
122 bool is_fg, struct Buffer *err)
123{
124 char *eptr = NULL;
125 bool is_alert = false, is_bright = false, is_light = false;
126 int clen;
127
128 if ((clen = mutt_istr_startswith(s, "bright")))
129 {
130 color_debug(LL_DEBUG5, "bright\n");
131 is_bright = true;
132 s += clen;
133 }
134 else if ((clen = mutt_istr_startswith(s, "alert")))
135 {
136 color_debug(LL_DEBUG5, "alert\n");
137 is_alert = true;
138 is_bright = true;
139 s += clen;
140 }
141 else if ((clen = mutt_istr_startswith(s, "light")))
142 {
143 color_debug(LL_DEBUG5, "light\n");
144 is_light = true;
145 s += clen;
146 }
147
148 /* allow aliases for xterm color resources */
149 if ((clen = mutt_istr_startswith(s, "color")))
150 {
151 s += clen;
152 *col = strtoul(s, &eptr, 10);
153 if ((*s == '\0') || (*eptr != '\0') || ((*col >= COLORS) && !OptNoCurses))
154 {
155 mutt_buffer_printf(err, _("%s: color not supported by term"), s);
156 return MUTT_CMD_ERROR;
157 }
158 color_debug(LL_DEBUG5, "colorNNN %d\n", *col);
159 }
160 else if ((*col = mutt_map_get_value(s, ColorNames)) == -1)
161 {
162 mutt_buffer_printf(err, _("%s: no such color"), s);
163 return MUTT_CMD_WARNING;
164 }
165 const char *name = mutt_map_get_name(*col, ColorNames);
166 if (name)
167 color_debug(LL_DEBUG5, "color: %s\n", name);
168
169 if (is_bright || is_light)
170 {
171 if (is_alert)
172 {
173 *attrs |= A_BOLD;
174 *attrs |= A_BLINK;
175 }
176 else if (is_fg)
177 {
178 if ((COLORS >= 16) && is_light)
179 {
180 if (*col <= 7)
181 {
182 /* Advance the color 0-7 by 8 to get the light version */
183 *col += 8;
184 }
185 }
186 else
187 {
188 *attrs |= A_BOLD;
189 }
190 }
191 else
192 {
193 if (COLORS >= 16)
194 {
195 if (*col <= 7)
196 {
197 /* Advance the color 0-7 by 8 to get the light version */
198 *col += 8;
199 }
200 }
201 }
202 }
203
204 return MUTT_CMD_SUCCESS;
205}
206
210static enum CommandResult parse_attr_spec(struct Buffer *buf, struct Buffer *s,
211 uint32_t *fg, uint32_t *bg,
212 int *attrs, struct Buffer *err)
213{
214 if (fg)
215 *fg = COLOR_UNSET;
216 if (bg)
217 *bg = COLOR_UNSET;
218
219 if (!MoreArgs(s))
220 {
221 mutt_buffer_printf(err, _("%s: too few arguments"), "mono");
222 return MUTT_CMD_WARNING;
223 }
224
226
227 if (mutt_istr_equal("bold", buf->data))
228 *attrs |= A_BOLD;
229 else if (mutt_istr_equal("italic", buf->data))
230 *attrs |= A_ITALIC;
231 else if (mutt_istr_equal("none", buf->data))
232 *attrs = A_NORMAL; // Use '=' to clear other bits
233 else if (mutt_istr_equal("normal", buf->data))
234 *attrs = A_NORMAL; // Use '=' to clear other bits
235 else if (mutt_istr_equal("reverse", buf->data))
236 *attrs |= A_REVERSE;
237 else if (mutt_istr_equal("standout", buf->data))
238 *attrs |= A_STANDOUT;
239 else if (mutt_istr_equal("underline", buf->data))
240 *attrs |= A_UNDERLINE;
241 else
242 {
243 mutt_buffer_printf(err, _("%s: no such attribute"), buf->data);
244 return MUTT_CMD_WARNING;
245 }
246
247 return MUTT_CMD_SUCCESS;
248}
249
255static enum CommandResult parse_color_pair(struct Buffer *buf, struct Buffer *s,
256 uint32_t *fg, uint32_t *bg,
257 int *attrs, struct Buffer *err)
258{
259 while (true)
260 {
261 if (!MoreArgs(s))
262 {
263 mutt_buffer_printf(err, _("%s: too few arguments"), "color");
264 return MUTT_CMD_WARNING;
265 }
266
268
269 if (mutt_istr_equal("bold", buf->data))
270 {
271 *attrs |= A_BOLD;
272 color_debug(LL_DEBUG5, "bold\n");
273 }
274 else if (mutt_istr_equal("italic", buf->data))
275 {
276 *attrs |= A_ITALIC;
277 color_debug(LL_DEBUG5, "italic\n");
278 }
279 else if (mutt_istr_equal("none", buf->data))
280 {
281 *attrs = A_NORMAL; // Use '=' to clear other bits
282 color_debug(LL_DEBUG5, "none\n");
283 }
284 else if (mutt_istr_equal("normal", buf->data))
285 {
286 *attrs = A_NORMAL; // Use '=' to clear other bits
287 color_debug(LL_DEBUG5, "normal\n");
288 }
289 else if (mutt_istr_equal("reverse", buf->data))
290 {
291 *attrs |= A_REVERSE;
292 color_debug(LL_DEBUG5, "reverse\n");
293 }
294 else if (mutt_istr_equal("standout", buf->data))
295 {
296 *attrs |= A_STANDOUT;
297 color_debug(LL_DEBUG5, "standout\n");
298 }
299 else if (mutt_istr_equal("underline", buf->data))
300 {
301 *attrs |= A_UNDERLINE;
302 color_debug(LL_DEBUG5, "underline\n");
303 }
304 else
305 {
306 enum CommandResult rc = parse_color_name(buf->data, fg, attrs, true, err);
307 if (rc != MUTT_CMD_SUCCESS)
308 return rc;
309 break;
310 }
311 }
312
313 if (!MoreArgs(s))
314 {
315 mutt_buffer_printf(err, _("%s: too few arguments"), "color");
316 return MUTT_CMD_WARNING;
317 }
318
320
321 return parse_color_name(buf->data, bg, attrs, false, err);
322}
323
329void get_colorid_name(unsigned int cid, struct Buffer *buf)
330{
331 const char *name = NULL;
332
334 {
336 if (name)
337 {
338 mutt_buffer_printf(buf, "compose %s", name);
339 return;
340 }
341 }
342
344 if (name)
345 mutt_buffer_printf(buf, "%s", name);
346 else
347 mutt_buffer_printf(buf, "UNKNOWN %d", cid);
348}
349
361static enum CommandResult parse_object(struct Buffer *buf, struct Buffer *s,
362 enum ColorId *cid, int *ql, struct Buffer *err)
363{
364 int rc;
365
366 if (mutt_str_startswith(buf->data, "quoted") != 0)
367 {
368 int val = 0;
369 if (buf->data[6] != '\0')
370 {
371 if (!mutt_str_atoi_full(buf->data + 6, &val) || (val > COLOR_QUOTES_MAX))
372 {
373 mutt_buffer_printf(err, _("%s: no such object"), buf->data);
374 return MUTT_CMD_WARNING;
375 }
376 }
377
378 *ql = val;
379 *cid = MT_COLOR_QUOTED;
380 return MUTT_CMD_SUCCESS;
381 }
382
383 if (mutt_istr_equal(buf->data, "compose"))
384 {
385 if (!MoreArgs(s))
386 {
387 mutt_buffer_printf(err, _("%s: too few arguments"), "color");
388 return MUTT_CMD_WARNING;
389 }
390
392
394 if (rc == -1)
395 {
396 mutt_buffer_printf(err, _("%s: no such object"), buf->data);
397 return MUTT_CMD_WARNING;
398 }
399
400 *cid = rc;
401 return MUTT_CMD_SUCCESS;
402 }
403
405 if (rc == -1)
406 {
407 mutt_buffer_printf(err, _("%s: no such object"), buf->data);
408 return MUTT_CMD_WARNING;
409 }
410 else
411 {
412 color_debug(LL_DEBUG5, "object: %s\n", mutt_map_get_name(rc, ColorFields));
413 }
414
415 *cid = rc;
416 return MUTT_CMD_SUCCESS;
417}
418
431static enum CommandResult parse_uncolor(struct Buffer *buf, struct Buffer *s,
432 struct Buffer *err, bool uncolor)
433{
435
436 if (mutt_str_equal(buf->data, "*"))
437 {
438 colors_clear();
439 return MUTT_CMD_SUCCESS;
440 }
441
442 unsigned int cid = MT_COLOR_NONE;
443 int ql = 0;
444 color_debug(LL_DEBUG5, "uncolor: %s\n", mutt_buffer_string(buf));
445 enum CommandResult rc = parse_object(buf, s, &cid, &ql, err);
446 if (rc != MUTT_CMD_SUCCESS)
447 return rc;
448
449 if (cid == -1)
450 {
451 mutt_buffer_printf(err, _("%s: no such object"), buf->data);
452 return MUTT_CMD_ERROR;
453 }
454
455 if (cid == MT_COLOR_QUOTED)
456 {
457 color_debug(LL_DEBUG5, "quoted\n");
458 return quoted_colors_parse_uncolor(cid, ql, err);
459 }
460
461 if ((cid == MT_COLOR_STATUS) && !MoreArgs(s))
462 {
463 color_debug(LL_DEBUG5, "simple\n");
464 simple_color_reset(cid); // default colour for the status bar
465 return MUTT_CMD_SUCCESS;
466 }
467
468 if (!mutt_color_has_pattern(cid))
469 {
470 color_debug(LL_DEBUG5, "simple\n");
472 return MUTT_CMD_SUCCESS;
473 }
474
475 if (OptNoCurses)
476 {
477 do
478 {
479 color_debug(LL_DEBUG5, "do nothing\n");
480 /* just eat the command, but don't do anything real about it */
482 } while (MoreArgs(s));
483
484 return MUTT_CMD_SUCCESS;
485 }
486
487 bool changes = false;
488 if (!MoreArgs(s))
489 {
490 if (regex_colors_parse_uncolor(cid, NULL, uncolor))
491 return MUTT_CMD_SUCCESS;
492 else
493 return MUTT_CMD_ERROR;
494 }
495
496 do
497 {
499 if (mutt_str_equal("*", buf->data))
500 {
501 if (regex_colors_parse_uncolor(cid, NULL, uncolor))
502 return MUTT_CMD_SUCCESS;
503 else
504 return MUTT_CMD_ERROR;
505 }
506
507 changes |= regex_colors_parse_uncolor(cid, buf->data, uncolor);
508
509 } while (MoreArgs(s));
510
511 if (changes)
513
514 return MUTT_CMD_SUCCESS;
515}
516
531static enum CommandResult parse_color(struct Buffer *buf, struct Buffer *s,
532 struct Buffer *err, parser_callback_t callback,
533 bool dry_run, bool color)
534{
535 int attrs = 0, q_level = 0;
536 uint32_t fg = 0, bg = 0, match = 0;
537 enum ColorId cid = MT_COLOR_NONE;
538 enum CommandResult rc;
539
540 if (!MoreArgs(s))
541 {
542 mutt_buffer_printf(err, _("%s: too few arguments"), "color");
543 return MUTT_CMD_WARNING;
544 }
545
547 color_debug(LL_DEBUG5, "color: %s\n", mutt_buffer_string(buf));
548
549 rc = parse_object(buf, s, &cid, &q_level, err);
550 if (rc != MUTT_CMD_SUCCESS)
551 return rc;
552
553 rc = callback(buf, s, &fg, &bg, &attrs, err);
554 if (rc != MUTT_CMD_SUCCESS)
555 return rc;
556
557 /* extract a regular expression if needed */
558
559 if (mutt_color_has_pattern(cid) && cid != MT_COLOR_STATUS)
560 {
561 color_debug(LL_DEBUG5, "regex needed\n");
562 if (MoreArgs(s))
563 {
565 }
566 else
567 {
568 mutt_buffer_strcpy(buf, ".*");
569 }
570 }
571
572 if (MoreArgs(s) && (cid != MT_COLOR_STATUS))
573 {
574 mutt_buffer_printf(err, _("%s: too many arguments"), color ? "color" : "mono");
575 return MUTT_CMD_WARNING;
576 }
577
578 if (dry_run)
579 {
580 color_debug(LL_DEBUG5, "dry_run bailout\n");
581 *s->dptr = '\0'; /* fake that we're done parsing */
582 return MUTT_CMD_SUCCESS;
583 }
584
585 /* The case of the tree object is special, because a non-default fg color of
586 * the tree element may be combined dynamically with the default bg color of
587 * an index line, not necessarily defined in a rc file. */
588 if (!OptNoCurses &&
589 ((fg == COLOR_DEFAULT) || (bg == COLOR_DEFAULT) || (cid == MT_COLOR_TREE)) &&
590 (use_default_colors() != OK))
591 {
592 mutt_buffer_strcpy(err, _("default colors not supported"));
593 return MUTT_CMD_ERROR;
594 }
595
596 if (regex_colors_parse_color_list(cid, buf->data, fg, bg, attrs, &rc, err))
597 {
598 color_debug(LL_DEBUG5, "regex_colors_parse_color_list done\n");
599 return rc;
600 // do nothing
601 }
602 else if (quoted_colors_parse_color(cid, fg, bg, attrs, q_level, &rc, err))
603 {
604 color_debug(LL_DEBUG5, "quoted_colors_parse_color done\n");
605 return rc;
606 // do nothing
607 }
608 else if ((cid == MT_COLOR_STATUS) && MoreArgs(s))
609 {
610 color_debug(LL_DEBUG5, "status\n");
611 /* 'color status fg bg' can have up to 2 arguments:
612 * 0 arguments: sets the default status color (handled below by else part)
613 * 1 argument : colorize pattern on match
614 * 2 arguments: colorize nth submatch of pattern */
616
617 if (MoreArgs(s))
618 {
619 struct Buffer tmp = mutt_buffer_make(0);
621 if (!mutt_str_atoui_full(tmp.data, &match))
622 {
623 mutt_buffer_printf(err, _("%s: invalid number: %s"),
624 color ? "color" : "mono", tmp.data);
626 return MUTT_CMD_WARNING;
627 }
629 }
630
631 if (MoreArgs(s))
632 {
633 mutt_buffer_printf(err, _("%s: too many arguments"), color ? "color" : "mono");
634 return MUTT_CMD_WARNING;
635 }
636
637 rc = regex_colors_parse_status_list(cid, buf->data, fg, bg, attrs, match, err);
638 return rc;
639 }
640 else // Remaining simple colours
641 {
642 color_debug(LL_DEBUG5, "simple\n");
643 if (simple_color_set(cid, fg, bg, attrs))
644 rc = MUTT_CMD_SUCCESS;
645 else
646 rc = MUTT_CMD_ERROR;
647 }
648
649 if (rc == MUTT_CMD_SUCCESS)
650 {
651 get_colorid_name(cid, buf);
652 color_debug(LL_DEBUG5, "NT_COLOR_SET: %s\n", buf->data);
653 struct EventColor ev_c = { cid, NULL };
655 }
656
657 return rc;
658}
659
663enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s,
664 intptr_t data, struct Buffer *err)
665{
666 if (OptNoCurses)
667 {
668 *s->dptr = '\0'; /* fake that we're done parsing */
669 return MUTT_CMD_SUCCESS;
670 }
671 color_debug(LL_DEBUG5, "parse: %s\n", mutt_buffer_string(buf));
672 enum CommandResult rc = parse_uncolor(buf, s, err, true);
673 // simple_colors_dump(false);
675 return rc;
676}
677
681enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s,
682 intptr_t data, struct Buffer *err)
683{
684 *s->dptr = '\0'; /* fake that we're done parsing */
685 return MUTT_CMD_SUCCESS;
686}
687
691enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s,
692 intptr_t data, struct Buffer *err)
693{
694 bool dry_run = OptNoCurses;
695
696 color_debug(LL_DEBUG5, "parse: %s\n", mutt_buffer_string(buf));
697 enum CommandResult rc = parse_color(buf, s, err, parse_color_pair, dry_run, true);
698 // simple_colors_dump(false);
700 return rc;
701}
702
706enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s,
707 intptr_t data, struct Buffer *err)
708{
709 return parse_color(buf, s, err, parse_attr_spec, true, false);
710}
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:67
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:327
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:309
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:168
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
#define MoreArgs(buf)
Definition: buffer.h:40
const struct Mapping ComposeColorFields[]
Mapping of compose colour names to their IDs.
Definition: command.c:99
void get_colorid_name(unsigned int cid, struct Buffer *buf)
Get the name of a color id.
Definition: command.c:329
const struct Mapping ColorFields[]
Mapping of colour names to their IDs.
Definition: command.c:45
static enum CommandResult parse_color(struct Buffer *buf, struct Buffer *s, struct Buffer *err, parser_callback_t callback, bool dry_run, bool color)
Parse a 'color' command.
Definition: command.c:531
static enum CommandResult parse_color_name(const char *s, uint32_t *col, int *attrs, bool is_fg, struct Buffer *err)
Parse a colour name.
Definition: command.c:121
static enum CommandResult parse_object(struct Buffer *buf, struct Buffer *s, enum ColorId *cid, int *ql, struct Buffer *err)
Identify a colour object.
Definition: command.c:361
static enum CommandResult parse_uncolor(struct Buffer *buf, struct Buffer *s, struct Buffer *err, bool uncolor)
Parse an 'uncolor' command.
Definition: command.c:431
struct Notify * ColorsNotify
Notifications: ColorId, EventColor.
Definition: notify.c:34
bool regex_colors_parse_uncolor(enum ColorId cid, const char *pat, bool uncolor)
Parse a Regex 'uncolor' command.
Definition: regex.c:439
bool regex_colors_parse_color_list(enum ColorId cid, const char *pat, uint32_t fg, uint32_t bg, int attrs, int *rc, struct Buffer *err)
Parse a Regex 'color' command.
Definition: regex.c:340
int regex_colors_parse_status_list(enum ColorId cid, const char *pat, uint32_t fg, uint32_t bg, int attrs, int match, struct Buffer *err)
Parse a Regex 'color status' command.
Definition: regex.c:410
struct AttrColor * simple_color_set(enum ColorId cid, int fg, int bg, int attrs)
Set the colour of a simple object.
Definition: simple.c:118
void simple_color_reset(enum ColorId cid)
Clear the colour of a simple object.
Definition: simple.c:144
const struct Mapping ColorNames[]
Definition: color.c:37
bool mutt_color_has_pattern(enum ColorId cid)
Check if a color object supports a regex pattern.
Definition: color.c:102
void colors_clear(void)
Reset all the simple, quoted and regex colours.
Definition: color.c:55
#define COLOR_DEFAULT
Definition: color.h:99
#define COLOR_UNSET
Definition: color.h:100
ColorId
List of all colored objects.
Definition: color.h:35
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition: color.h:61
@ MT_COLOR_MARKERS
Pager: markers, line continuation.
Definition: color.h:51
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition: color.h:43
@ MT_COLOR_MESSAGE
Informational message.
Definition: color.h:52
@ MT_COLOR_QUOTED
Pager: quoted text.
Definition: color.h:58
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:78
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:65
@ 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_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:68
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:84
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:49
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:67
@ MT_COLOR_ERROR
Error message.
Definition: color.h:46
@ MT_COLOR_NONE
Definition: color.h:36
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition: color.h:44
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:66
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:87
@ MT_COLOR_BOLD
Bold text.
Definition: color.h:40
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:85
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition: color.h:39
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:80
@ MT_COLOR_PROGRESS
Progress bar.
Definition: color.h:56
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition: color.h:42
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:86
@ MT_COLOR_HDRDEFAULT
Header default colour.
Definition: color.h:47
@ MT_COLOR_OPTIONS
Options in prompt.
Definition: color.h:55
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:73
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:54
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition: color.h:38
@ MT_COLOR_SEARCH
Pager: search matches.
Definition: color.h:59
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:45
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:82
@ MT_COLOR_ITALIC
Italic text.
Definition: color.h:50
@ MT_COLOR_PROMPT
Question/user input.
Definition: color.h:57
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:41
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:77
@ MT_COLOR_ATTACHMENT
MIME attachments text (entire line)
Definition: color.h:37
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:64
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:63
@ MT_COLOR_WARNING
Warning messages.
Definition: color.h:75
@ MT_COLOR_UNDERLINE
Underlined text.
Definition: color.h:74
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:83
@ MT_COLOR_SIGNATURE
Pager: signature lines.
Definition: color.h:70
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:81
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:62
@ MT_COLOR_TILDE
Pager: empty lines after message.
Definition: color.h:72
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:79
int(* parser_callback_t)(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
Definition: command2.h:46
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
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition: command.h:36
Convenience wrapper for the core headers.
void regex_colors_dump_all(void)
Dump all the Regex colours to the log.
Definition: debug.c:380
int color_debug(enum LogLevel level, const char *format,...)
Write to the log file.
Definition: debug.c:44
void curses_colors_dump(void)
Log all the Curses colours.
Definition: debug.c:267
enum CommandResult mutt_parse_unmono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unmono' command - Implements Command::parse() -.
Definition: command.c:681
enum CommandResult mutt_parse_mono(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'mono' command - Implements Command::parse() -.
Definition: command.c:706
enum CommandResult mutt_parse_color(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'color' command - Implements Command::parse() -.
Definition: command.c:691
enum CommandResult mutt_parse_uncolor(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'uncolor' command - Implements Command::parse() -.
Definition: command.c:663
static enum CommandResult parse_color_pair(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
Parse a pair of colours - Implements parser_callback_t -.
Definition: command.c:255
static enum CommandResult parse_attr_spec(struct Buffer *buf, struct Buffer *s, uint32_t *fg, uint32_t *bg, int *attrs, struct Buffer *err)
Parse an attribute description - Implements parser_callback_t -.
Definition: command.c:210
Convenience wrapper for the gui headers.
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.
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
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
Convenience wrapper for the library headers.
#define _(a)
Definition: message.h:28
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
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
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:227
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition: string.c:239
Many unsorted constants and some structs.
#define MUTT_TOKEN_NO_FLAGS
No flags are set.
Definition: mutt.h:67
@ NT_COLOR_SET
Color has been set.
Definition: notify2.h:41
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:41
Handling of global boolean variables.
bool OptNoCurses
(pseudo) when sending in batch mode
Definition: options.h:53
enum CommandResult quoted_colors_parse_uncolor(enum ColorId cid, int q_level, struct Buffer *err)
Parse the 'uncolor quoted' command.
Definition: quoted.c:163
bool quoted_colors_parse_color(enum ColorId cid, uint32_t fg, uint32_t bg, int attrs, int q_level, int *rc, struct Buffer *err)
Parse the 'color quoted' command.
Definition: quoted.c:99
#define COLOR_QUOTES_MAX
Ten colours, quoted0..quoted9 (quoted and quoted0 are equivalent)
Definition: quoted.h:37
Key value store.
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
An Event that happened to a Colour.
Definition: notify2.h:53
enum ColorId cid
Colour ID that has changed.
Definition: notify2.h:54
Mapping between user-readable string and a constant.
Definition: mapping.h:32
const char * name
String value.
Definition: mapping.h:33