forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quoted.h
85 lines (75 loc) · 2.83 KB
/
quoted.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* @file
* Quoted-Email colours
*
* @authors
* Copyright (C) 2021 Richard Russon <[email protected]>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUTT_COLOR_QUOTED_H
#define MUTT_COLOR_QUOTED_H
#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include "core/lib.h"
#include "color.h"
struct Buffer;
/// Ten colours, quoted0..quoted9 (quoted and quoted0 are equivalent)
#define COLOR_QUOTES_MAX 10
extern int QuotedColors[];
extern int NumQuotedColors;
/**
* struct QuoteStyle - Style of quoted text
*
* NeoMutt will store a tree of all the different email quoting levels it
* detects in an Email. If `$quote_regex` matches, say both "> " and "| ",
* and the Email has three levels of indent, then the tree will contain two
* siblings each with a child and grandchild.
*
* @dot
* digraph QuoteStyle
* {
* node [ shape="box" style="filled" fillcolor="#e0ffff" ]
* angle1 [ label=<">"> ]
* angle2 [ label=<"> >"> ]
* angle3 [ label=<"> > >"> ]
* bar1 [ label=<"|"> ]
* bar2 [ label=<"| |"> ]
* bar3 [ label=<"| | |"> ]
* angle1 -> angle2 -> angle3
* bar1 -> bar2 -> bar3
* angle1 -> bar1
* { rank=same angle1 bar1 }
* }
* @enddot
*/
struct QuoteStyle
{
int quote_n; ///< The quoteN colour index for this level
int color; ///< Curses colour pair
char *prefix; ///< Prefix string, e.g. "> "
size_t prefix_len; ///< Length of the prefix string
struct QuoteStyle *prev, *next; ///< Different quoting styles at the same level
struct QuoteStyle *up, *down; ///< Parent (less quoted) and child (more quoted) levels
};
void quoted_colors_clear(void);
int quoted_colors_get(int q);
void quoted_colors_init(void);
int quoted_colors_num_used(void);
bool quoted_colors_parse_color (enum ColorId cid, uint32_t fg, uint32_t bg, int attrs, int q_level, int *rc, struct Buffer *err);
struct QuoteStyle *qstyle_classify (struct QuoteStyle **quote_list, const char *qptr, size_t length, bool *force_redraw, int *q_level);
void qstyle_free_tree(struct QuoteStyle **quote_list);
#endif /* MUTT_COLOR_QUOTED_H */