1 | #ifndef NVIM_BUFHL_DEFS_H |
2 | #define NVIM_BUFHL_DEFS_H |
3 | |
4 | #include "nvim/pos.h" |
5 | #include "nvim/lib/kvec.h" |
6 | #include "nvim/lib/kbtree.h" |
7 | |
8 | // bufhl: buffer specific highlighting |
9 | |
10 | typedef struct { |
11 | int src_id; |
12 | int hl_id; // highlight group |
13 | colnr_T start; // first column to highlight |
14 | colnr_T stop; // last column to highlight |
15 | } BufhlItem; |
16 | |
17 | typedef struct { |
18 | char *text; |
19 | int hl_id; |
20 | } VirtTextChunk; |
21 | |
22 | typedef kvec_t(VirtTextChunk) VirtText; |
23 | |
24 | typedef struct { |
25 | linenr_T line; |
26 | kvec_t(BufhlItem) items; |
27 | int virt_text_src; |
28 | VirtText virt_text; |
29 | } BufhlLine; |
30 | #define BUFHLLINE_INIT(l) { l, KV_INITIAL_VALUE, 0, KV_INITIAL_VALUE } |
31 | |
32 | typedef struct { |
33 | BufhlLine *line; |
34 | int current; |
35 | colnr_T valid_to; |
36 | } BufhlLineInfo; |
37 | |
38 | #define BUFHL_CMP(a, b) ((int)(((a)->line - (b)->line))) |
39 | KBTREE_INIT(bufhl, BufhlLine *, BUFHL_CMP, 10) // -V512 |
40 | typedef kbtree_t(bufhl) BufhlInfo; |
41 | #endif // NVIM_BUFHL_DEFS_H |
42 | |