summaryrefslogtreecommitdiff
path: root/src/cell.h
blob: 615879ee14ea39729075c938d10af8f53ed91515 (plain)
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
#ifndef TERM_CELL_H
#define TERM_CELL_H

/*
 * The cell layout that the terminal stores. Only src/term uses it. A
 * snapshot converts these cells to the public struct term_cell.
 */

#include "term.h"

enum cell_flags {
    CELL_BOLD      = TERM_ATTR_BOLD,
    CELL_ITALIC    = TERM_ATTR_ITALIC,
    CELL_UNDERLINE = TERM_ATTR_UNDERLINE,
    CELL_STRIKE    = TERM_ATTR_STRIKE,
    CELL_OVERLINE  = TERM_ATTR_OVERLINE,
    CELL_EMOJI     = TERM_ATTR_EMOJI,
    CELL_TEXT      = TERM_ATTR_TEXT,
    CELL_WIDE      = 1 << 7,
    CELL_TRAIL     = 1 << 8,
    CELL_WRAP_PAD  = 1 << 9,
    CELL_FAINT     = TERM_ATTR_FAINT,
    CELL_DOUBLE_UNDERLINE = TERM_ATTR_DOUBLE_UNDERLINE,
    CELL_CURLY_UNDERLINE  = TERM_ATTR_CURLY_UNDERLINE,
    CELL_DOTTED_UNDERLINE = TERM_ATTR_DOTTED_UNDERLINE,
    CELL_DASHED_UNDERLINE = TERM_ATTR_DASHED_UNDERLINE,
    CELL_LINK      = TERM_ATTR_LINK,
};

#define CELL_ANY_UNDERLINE TERM_ATTR_UNDERLINE_MASK

/* c is a code point or a grapheme handle. pad holds the OSC 8 link id. */
struct cell {
    uint32_t c;
    uint32_t fg;
    uint32_t bg;
    uint16_t flags;
    uint16_t pad;
};

_Static_assert(sizeof(struct cell) == 16,
               "struct cell must stay 16 bytes (4 cells per AVX-512 register)");

#endif