NeoMutt  2021-10-29-220-g2b1eec
Teaching an old dog new tricks
DOXYGEN
regex4.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_COLOR_REGEX_H
24 #define MUTT_COLOR_REGEX_H
25 
26 #include "config.h"
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include "mutt/lib.h"
30 #include "lib.h"
31 
35 struct RegexColor
36 {
37  char *pattern;
38  regex_t regex;
39  int match;
40  struct PatternList *color_pattern;
41  uint32_t fg;
42  uint32_t bg;
43  int pair;
44 
45  bool stop_matching : 1;
46 
48 };
49 STAILQ_HEAD(RegexColorList, RegexColor);
50 
51 void regex_color_free(struct RegexColor **ptr, bool free_colors);
52 void regex_color_list_clear(struct RegexColorList *rcl);
53 struct RegexColor * regex_color_new (void);
54 void regex_colors_clear(void);
55 struct RegexColorList *regex_colors_get_list(enum ColorId cid);
56 void regex_colors_init(void);
57 
58 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);
59 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);
60 
61 enum CommandResult add_pattern(struct RegexColorList *top, const char *s, bool sensitive, uint32_t fg, uint32_t bg, int attr, struct Buffer *err, bool is_index, int match);
62 
63 #endif /* MUTT_COLOR_REGEX_H */
ColorId
List of all colored objects.
Definition: color.h:35
CommandResult
Error codes for command_t parse functions.
Definition: command.h:34
Convenience wrapper for the library headers.
void regex_colors_clear(void)
Clear the Regex colours.
Definition: regex.c:112
void regex_colors_init(void)
Initialise the Regex colours.
Definition: regex.c:96
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a colour id.
Definition: regex.c:130
struct RegexColor * regex_color_new(void)
Create a new RegexColor.
Definition: regex.c:161
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:290
enum CommandResult add_pattern(struct RegexColorList *top, const char *s, bool sensitive, uint32_t fg, uint32_t bg, int attr, struct Buffer *err, bool is_index, int match)
Associate a colour to a pattern.
Definition: regex.c:187
void regex_color_free(struct RegexColor **ptr, bool free_colors)
Free a RegexColor.
Definition: regex.c:63
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:338
void regex_color_list_clear(struct RegexColorList *rcl)
Clear a list of colours.
Definition: regex.c:83
STAILQ_HEAD(RegexColorList, RegexColor)
Key value store.
String manipulation buffer.
Definition: buffer.h:34
A regular expression and a color to highlight a line.
Definition: regex4.h:36
regex_t regex
Compiled regex.
Definition: regex4.h:38
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: regex4.h:40
int pair
Colour pair index.
Definition: regex4.h:43
char * pattern
Pattern to match.
Definition: regex4.h:37
uint32_t bg
Background colour.
Definition: regex4.h:42
bool stop_matching
Used by the pager for body patterns, to prevent the color from being retried once it fails.
Definition: regex4.h:45
int match
Substring to match, 0 for old behaviour.
Definition: regex4.h:39
uint32_t fg
Foreground colour.
Definition: regex4.h:41
STAILQ_ENTRY(RegexColor) entries
Linked list.