NeoMutt  2023-03-22-27-g3cb248
Teaching an old dog new tricks
DOXYGEN
regex4.h
Go to the documentation of this file.
1
23#ifndef MUTT_COLOR_REGEX4_H
24#define MUTT_COLOR_REGEX4_H
25
26#include "config.h"
27#include <stdbool.h>
28#include <stdint.h>
29#include "mutt/lib.h"
30#include "attr.h"
31#include "color.h"
32
37{
39 char *pattern;
40 regex_t regex;
41 int match;
42 struct PatternList *color_pattern;
43
44 bool stop_matching : 1;
45
47};
48STAILQ_HEAD(RegexColorList, RegexColor);
49
50#ifdef USE_DEBUG_COLOR
51extern struct RegexColorList AttachList;
52extern struct RegexColorList BodyList;
53extern struct RegexColorList HeaderList;
54extern struct RegexColorList IndexAuthorList;
55extern struct RegexColorList IndexFlagsList;
56extern struct RegexColorList IndexList;
57extern struct RegexColorList IndexSubjectList;
58extern struct RegexColorList IndexTagList;
59extern struct RegexColorList StatusList;
60#endif
61
62void regex_color_clear(struct RegexColor *rcol);
63void regex_color_free(struct RegexColorList *list, struct RegexColor **ptr);
64struct RegexColor * regex_color_new (void);
65
66void regex_colors_clear(void);
67struct RegexColorList *regex_colors_get_list(enum ColorId cid);
68void regex_colors_init(void);
69
70void regex_color_list_clear(struct RegexColorList *rcl);
71
72bool regex_colors_parse_color_list (enum ColorId cid, const char *pat, uint32_t fg, uint32_t bg, int attrs, int *rc, struct Buffer *err);
73int regex_colors_parse_status_list(enum ColorId cid, const char *pat, uint32_t fg, uint32_t bg, int attrs, int match, struct Buffer *err);
74bool regex_colors_parse_uncolor (enum ColorId cid, const char *pat, bool uncolor);
75
76#endif /* MUTT_COLOR_REGEX4_H */
Colour and attributes.
struct RegexColorList IndexFlagsList
List of colours applied to the flags in the index.
Definition: regex.c:54
struct RegexColorList IndexAuthorList
List of colours applied to the author in the index.
Definition: regex.c:51
struct RegexColorList IndexSubjectList
List of colours applied to the subject in the index.
Definition: regex.c:59
struct RegexColorList StatusList
List of colours applied to the status bar.
Definition: regex.c:62
struct RegexColorList IndexList
List of default colours applied to the index.
Definition: regex.c:56
struct RegexColorList IndexTagList
List of colours applied to tags in the index.
Definition: regex.c:60
struct RegexColorList BodyList
List of colours applied to the email body.
Definition: regex.c:49
struct RegexColorList HeaderList
List of colours applied to the email headers.
Definition: regex.c:50
struct RegexColorList AttachList
List of colours applied to the attachment headers.
Definition: regex.c:48
Color and attribute parsing.
ColorId
List of all colored objects.
Definition: color.h:38
Convenience wrapper for the library headers.
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a colour id.
Definition: regex.c:184
void regex_colors_clear(void)
Clear the Regex colours.
Definition: regex.c:91
void regex_colors_init(void)
Initialise the Regex colours.
Definition: regex.c:68
void regex_color_free(struct RegexColorList *list, struct RegexColor **ptr)
Free a Regex colour.
Definition: regex.c:136
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
struct RegexColor * regex_color_new(void)
Create a new RegexColor.
Definition: regex.c:151
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
void regex_color_list_clear(struct RegexColorList *rcl)
Free the contents of a RegexColorList.
Definition: regex.c:166
STAILQ_HEAD(RegexColorList, RegexColor)
void regex_color_clear(struct RegexColor *rcol)
Free the contents of a Regex colour.
Definition: regex.c:117
A curses colour and its attributes.
Definition: attr.h:35
String manipulation buffer.
Definition: buffer.h:34
A regular expression and a color to highlight a line.
Definition: regex4.h:37
regex_t regex
Compiled regex.
Definition: regex4.h:40
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: regex4.h:42
struct AttrColor attr_color
Colour and attributes to apply.
Definition: regex4.h:38
char * pattern
Pattern to match.
Definition: regex4.h:39
bool stop_matching
Used by the pager for body patterns, to prevent the color from being retried once it fails.
Definition: regex4.h:44
int match
Substring to match, 0 for old behaviour.
Definition: regex4.h:41
STAILQ_ENTRY(RegexColor) entries
Linked list.