1dae0a4e0SAdrien Destugues - PulkoMandy #ifndef __VTERM_H__
2dae0a4e0SAdrien Destugues - PulkoMandy #define __VTERM_H__
3dae0a4e0SAdrien Destugues - PulkoMandy
4dae0a4e0SAdrien Destugues - PulkoMandy #include <stdint.h>
5dae0a4e0SAdrien Destugues - PulkoMandy #include <stdlib.h>
6dae0a4e0SAdrien Destugues - PulkoMandy
7dae0a4e0SAdrien Destugues - PulkoMandy #include "vterm_input.h"
8dae0a4e0SAdrien Destugues - PulkoMandy
9dae0a4e0SAdrien Destugues - PulkoMandy typedef struct VTerm VTerm;
10dae0a4e0SAdrien Destugues - PulkoMandy typedef struct VTermState VTermState;
11dae0a4e0SAdrien Destugues - PulkoMandy typedef struct VTermScreen VTermScreen;
12dae0a4e0SAdrien Destugues - PulkoMandy
13dae0a4e0SAdrien Destugues - PulkoMandy typedef struct {
14dae0a4e0SAdrien Destugues - PulkoMandy int row;
15dae0a4e0SAdrien Destugues - PulkoMandy int col;
16dae0a4e0SAdrien Destugues - PulkoMandy } VTermPos;
17dae0a4e0SAdrien Destugues - PulkoMandy
18dae0a4e0SAdrien Destugues - PulkoMandy /* some small utility functions; we can just keep these static here */
19dae0a4e0SAdrien Destugues - PulkoMandy
20dae0a4e0SAdrien Destugues - PulkoMandy /* order points by on-screen flow order */
vterm_pos_cmp(VTermPos a,VTermPos b)21dae0a4e0SAdrien Destugues - PulkoMandy static inline int vterm_pos_cmp(VTermPos a, VTermPos b)
22dae0a4e0SAdrien Destugues - PulkoMandy {
23dae0a4e0SAdrien Destugues - PulkoMandy return (a.row == b.row) ? a.col - b.col : a.row - b.row;
24dae0a4e0SAdrien Destugues - PulkoMandy }
25dae0a4e0SAdrien Destugues - PulkoMandy
26dae0a4e0SAdrien Destugues - PulkoMandy typedef struct {
27dae0a4e0SAdrien Destugues - PulkoMandy int start_row;
28dae0a4e0SAdrien Destugues - PulkoMandy int end_row;
29dae0a4e0SAdrien Destugues - PulkoMandy int start_col;
30dae0a4e0SAdrien Destugues - PulkoMandy int end_col;
31dae0a4e0SAdrien Destugues - PulkoMandy } VTermRect;
32dae0a4e0SAdrien Destugues - PulkoMandy
33dae0a4e0SAdrien Destugues - PulkoMandy /* true if the rect contains the point */
vterm_rect_contains(VTermRect r,VTermPos p)34dae0a4e0SAdrien Destugues - PulkoMandy static inline int vterm_rect_contains(VTermRect r, VTermPos p)
35dae0a4e0SAdrien Destugues - PulkoMandy {
36dae0a4e0SAdrien Destugues - PulkoMandy return p.row >= r.start_row && p.row < r.end_row &&
37dae0a4e0SAdrien Destugues - PulkoMandy p.col >= r.start_col && p.col < r.end_col;
38dae0a4e0SAdrien Destugues - PulkoMandy }
39dae0a4e0SAdrien Destugues - PulkoMandy
40dae0a4e0SAdrien Destugues - PulkoMandy /* move a rect */
vterm_rect_move(VTermRect * rect,int row_delta,int col_delta)41dae0a4e0SAdrien Destugues - PulkoMandy static inline void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta)
42dae0a4e0SAdrien Destugues - PulkoMandy {
43dae0a4e0SAdrien Destugues - PulkoMandy rect->start_row += row_delta; rect->end_row += row_delta;
44dae0a4e0SAdrien Destugues - PulkoMandy rect->start_col += col_delta; rect->end_col += col_delta;
45dae0a4e0SAdrien Destugues - PulkoMandy }
46dae0a4e0SAdrien Destugues - PulkoMandy
47dae0a4e0SAdrien Destugues - PulkoMandy typedef struct {
48dae0a4e0SAdrien Destugues - PulkoMandy uint8_t red, green, blue;
49dae0a4e0SAdrien Destugues - PulkoMandy } VTermColor;
50dae0a4e0SAdrien Destugues - PulkoMandy
51dae0a4e0SAdrien Destugues - PulkoMandy typedef enum {
52dae0a4e0SAdrien Destugues - PulkoMandy /* VTERM_VALUETYPE_NONE = 0 */
53dae0a4e0SAdrien Destugues - PulkoMandy VTERM_VALUETYPE_BOOL = 1,
54dae0a4e0SAdrien Destugues - PulkoMandy VTERM_VALUETYPE_INT,
55dae0a4e0SAdrien Destugues - PulkoMandy VTERM_VALUETYPE_STRING,
56dae0a4e0SAdrien Destugues - PulkoMandy VTERM_VALUETYPE_COLOR,
57dae0a4e0SAdrien Destugues - PulkoMandy } VTermValueType;
58dae0a4e0SAdrien Destugues - PulkoMandy
59dae0a4e0SAdrien Destugues - PulkoMandy typedef union {
60dae0a4e0SAdrien Destugues - PulkoMandy int boolean;
61dae0a4e0SAdrien Destugues - PulkoMandy int number;
62dae0a4e0SAdrien Destugues - PulkoMandy char *string;
63dae0a4e0SAdrien Destugues - PulkoMandy VTermColor color;
64dae0a4e0SAdrien Destugues - PulkoMandy } VTermValue;
65dae0a4e0SAdrien Destugues - PulkoMandy
66dae0a4e0SAdrien Destugues - PulkoMandy typedef enum {
67dae0a4e0SAdrien Destugues - PulkoMandy /* VTERM_ATTR_NONE = 0 */
68dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_BOLD = 1, // bool: 1, 22
69dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_UNDERLINE, // number: 4, 21, 24
70dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_ITALIC, // bool: 3, 23
71dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_BLINK, // bool: 5, 25
72dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_REVERSE, // bool: 7, 27
73dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_STRIKE, // bool: 9, 29
74dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_FONT, // number: 10-19
75dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_FOREGROUND, // color: 30-39 90-97
76dae0a4e0SAdrien Destugues - PulkoMandy VTERM_ATTR_BACKGROUND, // color: 40-49 100-107
77dae0a4e0SAdrien Destugues - PulkoMandy } VTermAttr;
78dae0a4e0SAdrien Destugues - PulkoMandy
79dae0a4e0SAdrien Destugues - PulkoMandy typedef enum {
80dae0a4e0SAdrien Destugues - PulkoMandy /* VTERM_PROP_NONE = 0 */
81dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_CURSORVISIBLE = 1, // bool
82dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_CURSORBLINK, // bool
83dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_ALTSCREEN, // bool
84dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_TITLE, // string
85dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_ICONNAME, // string
86dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_REVERSE, // bool
87dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_CURSORSHAPE, // number
88dae0a4e0SAdrien Destugues - PulkoMandy } VTermProp;
89dae0a4e0SAdrien Destugues - PulkoMandy
90dae0a4e0SAdrien Destugues - PulkoMandy enum {
91dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_CURSORSHAPE_BLOCK = 1,
92dae0a4e0SAdrien Destugues - PulkoMandy VTERM_PROP_CURSORSHAPE_UNDERLINE,
93*1ec25517SAdrien Destugues VTERM_PROP_CURSORSHAPE_BAR_LEFT,
94dae0a4e0SAdrien Destugues - PulkoMandy };
95dae0a4e0SAdrien Destugues - PulkoMandy
96dae0a4e0SAdrien Destugues - PulkoMandy typedef void (*VTermMouseFunc)(int x, int y, int button, int pressed, int modifiers, void *data);
97dae0a4e0SAdrien Destugues - PulkoMandy
98dae0a4e0SAdrien Destugues - PulkoMandy typedef struct {
99*1ec25517SAdrien Destugues const uint32_t *chars;
100*1ec25517SAdrien Destugues int width;
101*1ec25517SAdrien Destugues unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */
102*1ec25517SAdrien Destugues unsigned int dwl:1; /* DECDWL or DECDHL double-width line */
103*1ec25517SAdrien Destugues unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */
104*1ec25517SAdrien Destugues } VTermGlyphInfo;
105dae0a4e0SAdrien Destugues - PulkoMandy
106dae0a4e0SAdrien Destugues - PulkoMandy typedef struct {
107*1ec25517SAdrien Destugues unsigned int doublewidth:1; /* DECDWL or DECDHL line */
108*1ec25517SAdrien Destugues unsigned int doubleheight:2; /* DECDHL line (1=top 2=bottom) */
109*1ec25517SAdrien Destugues } VTermLineInfo;
110dae0a4e0SAdrien Destugues - PulkoMandy
111dae0a4e0SAdrien Destugues - PulkoMandy typedef struct {
112dae0a4e0SAdrien Destugues - PulkoMandy /* libvterm relies on this memory to be zeroed out before it is returned
113dae0a4e0SAdrien Destugues - PulkoMandy * by the allocator. */
114dae0a4e0SAdrien Destugues - PulkoMandy void *(*malloc)(size_t size, void *allocdata);
115dae0a4e0SAdrien Destugues - PulkoMandy void (*free)(void *ptr, void *allocdata);
116dae0a4e0SAdrien Destugues - PulkoMandy } VTermAllocatorFunctions;
117dae0a4e0SAdrien Destugues - PulkoMandy
118dae0a4e0SAdrien Destugues - PulkoMandy VTerm *vterm_new(int rows, int cols);
119dae0a4e0SAdrien Destugues - PulkoMandy VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata);
120dae0a4e0SAdrien Destugues - PulkoMandy void vterm_free(VTerm* vt);
121dae0a4e0SAdrien Destugues - PulkoMandy
122*1ec25517SAdrien Destugues void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp);
123dae0a4e0SAdrien Destugues - PulkoMandy void vterm_set_size(VTerm *vt, int rows, int cols);
124dae0a4e0SAdrien Destugues - PulkoMandy
125*1ec25517SAdrien Destugues void vterm_push_bytes(VTerm *vt, const char *bytes, size_t len);
126*1ec25517SAdrien Destugues
127*1ec25517SAdrien Destugues void vterm_input_push_char(VTerm *vt, VTermModifier state, uint32_t c);
128*1ec25517SAdrien Destugues void vterm_input_push_key(VTerm *vt, VTermModifier state, VTermKey key);
129*1ec25517SAdrien Destugues
130*1ec25517SAdrien Destugues size_t vterm_output_bufferlen(VTerm *vt); /* deprecated */
131*1ec25517SAdrien Destugues
132*1ec25517SAdrien Destugues size_t vterm_output_get_buffer_size(const VTerm *vt);
133*1ec25517SAdrien Destugues size_t vterm_output_get_buffer_current(const VTerm *vt);
134*1ec25517SAdrien Destugues size_t vterm_output_get_buffer_remaining(const VTerm *vt);
135*1ec25517SAdrien Destugues
136*1ec25517SAdrien Destugues size_t vterm_output_bufferread(VTerm *vt, char *buffer, size_t len);
137*1ec25517SAdrien Destugues
138*1ec25517SAdrien Destugues // ------------
139*1ec25517SAdrien Destugues // Parser layer
140*1ec25517SAdrien Destugues // ------------
141*1ec25517SAdrien Destugues
142*1ec25517SAdrien Destugues /* Flag to indicate non-final subparameters in a single CSI parameter.
143*1ec25517SAdrien Destugues * Consider
144*1ec25517SAdrien Destugues * CSI 1;2:3:4;5a
145*1ec25517SAdrien Destugues * 1 4 and 5 are final.
146*1ec25517SAdrien Destugues * 2 and 3 are non-final and will have this bit set
147*1ec25517SAdrien Destugues *
148*1ec25517SAdrien Destugues * Don't confuse this with the final byte of the CSI escape; 'a' in this case.
149*1ec25517SAdrien Destugues */
150*1ec25517SAdrien Destugues #define CSI_ARG_FLAG_MORE (1<<31)
151*1ec25517SAdrien Destugues #define CSI_ARG_MASK (~(1<<31))
152*1ec25517SAdrien Destugues
153*1ec25517SAdrien Destugues #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
154*1ec25517SAdrien Destugues #define CSI_ARG(a) ((a) & CSI_ARG_MASK)
155*1ec25517SAdrien Destugues
156*1ec25517SAdrien Destugues /* Can't use -1 to indicate a missing argument; use this instead */
157*1ec25517SAdrien Destugues #define CSI_ARG_MISSING ((1UL<<31)-1)
158*1ec25517SAdrien Destugues
159*1ec25517SAdrien Destugues #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING)
160*1ec25517SAdrien Destugues #define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a))
161*1ec25517SAdrien Destugues #define CSI_ARG_COUNT(a) (CSI_ARG(a) == CSI_ARG_MISSING || CSI_ARG(a) == 0 ? 1 : CSI_ARG(a))
162*1ec25517SAdrien Destugues
163*1ec25517SAdrien Destugues typedef struct {
164*1ec25517SAdrien Destugues int (*text)(const char *bytes, size_t len, void *user);
165*1ec25517SAdrien Destugues int (*control)(unsigned char control, void *user);
166*1ec25517SAdrien Destugues int (*escape)(const char *bytes, size_t len, void *user);
167*1ec25517SAdrien Destugues int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user);
168*1ec25517SAdrien Destugues int (*osc)(const char *command, size_t cmdlen, void *user);
169*1ec25517SAdrien Destugues int (*dcs)(const char *command, size_t cmdlen, void *user);
170*1ec25517SAdrien Destugues int (*resize)(int rows, int cols, void *user);
171*1ec25517SAdrien Destugues } VTermParserCallbacks;
172*1ec25517SAdrien Destugues
173dae0a4e0SAdrien Destugues - PulkoMandy void vterm_set_parser_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user);
174dae0a4e0SAdrien Destugues - PulkoMandy
175*1ec25517SAdrien Destugues void vterm_parser_set_utf8(VTerm *vt, int is_utf8);
176*1ec25517SAdrien Destugues
177*1ec25517SAdrien Destugues // -----------
178*1ec25517SAdrien Destugues // State layer
179*1ec25517SAdrien Destugues // -----------
180*1ec25517SAdrien Destugues
181*1ec25517SAdrien Destugues typedef struct {
182*1ec25517SAdrien Destugues int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user);
183*1ec25517SAdrien Destugues int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user);
184*1ec25517SAdrien Destugues int (*scrollrect)(VTermRect rect, int downward, int rightward, void *user);
185*1ec25517SAdrien Destugues int (*moverect)(VTermRect dest, VTermRect src, void *user);
186*1ec25517SAdrien Destugues int (*erase)(VTermRect rect, int selective, void *user);
187*1ec25517SAdrien Destugues int (*initpen)(void *user);
188*1ec25517SAdrien Destugues int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user);
189*1ec25517SAdrien Destugues int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
190*1ec25517SAdrien Destugues int (*setmousefunc)(VTermMouseFunc func, void *data, void *user);
191*1ec25517SAdrien Destugues int (*bell)(void *user);
192*1ec25517SAdrien Destugues int (*resize)(int rows, int cols, VTermPos *delta, void *user);
193*1ec25517SAdrien Destugues int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user);
194*1ec25517SAdrien Destugues } VTermStateCallbacks;
195*1ec25517SAdrien Destugues
196dae0a4e0SAdrien Destugues - PulkoMandy VTermState *vterm_obtain_state(VTerm *vt);
197dae0a4e0SAdrien Destugues - PulkoMandy
198dae0a4e0SAdrien Destugues - PulkoMandy void vterm_state_reset(VTermState *state, int hard);
199dae0a4e0SAdrien Destugues - PulkoMandy void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user);
200*1ec25517SAdrien Destugues void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
201*1ec25517SAdrien Destugues void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg);
202*1ec25517SAdrien Destugues void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col);
203*1ec25517SAdrien Destugues void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg);
204*1ec25517SAdrien Destugues void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col);
205dae0a4e0SAdrien Destugues - PulkoMandy void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright);
206*1ec25517SAdrien Destugues int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val);
207*1ec25517SAdrien Destugues int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val);
208*1ec25517SAdrien Destugues const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row);
209dae0a4e0SAdrien Destugues - PulkoMandy
210*1ec25517SAdrien Destugues // ------------
211*1ec25517SAdrien Destugues // Screen layer
212*1ec25517SAdrien Destugues // ------------
213*1ec25517SAdrien Destugues
214*1ec25517SAdrien Destugues typedef struct {
215*1ec25517SAdrien Destugues #define VTERM_MAX_CHARS_PER_CELL 6
216*1ec25517SAdrien Destugues uint32_t chars[VTERM_MAX_CHARS_PER_CELL];
217*1ec25517SAdrien Destugues char width;
218*1ec25517SAdrien Destugues struct {
219*1ec25517SAdrien Destugues unsigned int bold : 1;
220*1ec25517SAdrien Destugues unsigned int underline : 2;
221*1ec25517SAdrien Destugues unsigned int italic : 1;
222*1ec25517SAdrien Destugues unsigned int blink : 1;
223*1ec25517SAdrien Destugues unsigned int reverse : 1;
224*1ec25517SAdrien Destugues unsigned int strike : 1;
225*1ec25517SAdrien Destugues unsigned int font : 4; /* 0 to 9 */
226*1ec25517SAdrien Destugues unsigned int dwl : 1; /* On a DECDWL or DECDHL line */
227*1ec25517SAdrien Destugues unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */
228*1ec25517SAdrien Destugues } attrs;
229*1ec25517SAdrien Destugues VTermColor fg, bg;
230*1ec25517SAdrien Destugues } VTermScreenCell;
231*1ec25517SAdrien Destugues
232*1ec25517SAdrien Destugues typedef struct {
233*1ec25517SAdrien Destugues int (*damage)(VTermRect rect, void *user);
234*1ec25517SAdrien Destugues int (*moverect)(VTermRect dest, VTermRect src, void *user);
235*1ec25517SAdrien Destugues int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user);
236*1ec25517SAdrien Destugues int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
237*1ec25517SAdrien Destugues int (*setmousefunc)(VTermMouseFunc func, void *data, void *user);
238*1ec25517SAdrien Destugues int (*bell)(void *user);
239*1ec25517SAdrien Destugues int (*resize)(int rows, int cols, void *user);
240*1ec25517SAdrien Destugues int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user);
241*1ec25517SAdrien Destugues int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
242*1ec25517SAdrien Destugues } VTermScreenCallbacks;
243dae0a4e0SAdrien Destugues - PulkoMandy
244dae0a4e0SAdrien Destugues - PulkoMandy VTermScreen *vterm_obtain_screen(VTerm *vt);
245dae0a4e0SAdrien Destugues - PulkoMandy
246dae0a4e0SAdrien Destugues - PulkoMandy void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen);
247dae0a4e0SAdrien Destugues - PulkoMandy void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user);
248dae0a4e0SAdrien Destugues - PulkoMandy
249dae0a4e0SAdrien Destugues - PulkoMandy typedef enum {
250dae0a4e0SAdrien Destugues - PulkoMandy VTERM_DAMAGE_CELL, /* every cell */
251dae0a4e0SAdrien Destugues - PulkoMandy VTERM_DAMAGE_ROW, /* entire rows */
252dae0a4e0SAdrien Destugues - PulkoMandy VTERM_DAMAGE_SCREEN, /* entire screen */
253dae0a4e0SAdrien Destugues - PulkoMandy VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */
254dae0a4e0SAdrien Destugues - PulkoMandy } VTermDamageSize;
255dae0a4e0SAdrien Destugues - PulkoMandy
256dae0a4e0SAdrien Destugues - PulkoMandy void vterm_screen_flush_damage(VTermScreen *screen);
257dae0a4e0SAdrien Destugues - PulkoMandy void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size);
258dae0a4e0SAdrien Destugues - PulkoMandy
259dae0a4e0SAdrien Destugues - PulkoMandy void vterm_screen_reset(VTermScreen *screen, int hard);
260dae0a4e0SAdrien Destugues - PulkoMandy
261*1ec25517SAdrien Destugues /* Neither of these functions NUL-terminate the buffer */
262*1ec25517SAdrien Destugues size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect);
263*1ec25517SAdrien Destugues size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect);
264dae0a4e0SAdrien Destugues - PulkoMandy
265*1ec25517SAdrien Destugues typedef enum {
266*1ec25517SAdrien Destugues VTERM_ATTR_BOLD_MASK = 1 << 0,
267*1ec25517SAdrien Destugues VTERM_ATTR_UNDERLINE_MASK = 1 << 1,
268*1ec25517SAdrien Destugues VTERM_ATTR_ITALIC_MASK = 1 << 2,
269*1ec25517SAdrien Destugues VTERM_ATTR_BLINK_MASK = 1 << 3,
270*1ec25517SAdrien Destugues VTERM_ATTR_REVERSE_MASK = 1 << 4,
271*1ec25517SAdrien Destugues VTERM_ATTR_STRIKE_MASK = 1 << 5,
272*1ec25517SAdrien Destugues VTERM_ATTR_FONT_MASK = 1 << 6,
273*1ec25517SAdrien Destugues VTERM_ATTR_FOREGROUND_MASK = 1 << 7,
274*1ec25517SAdrien Destugues VTERM_ATTR_BACKGROUND_MASK = 1 << 8,
275*1ec25517SAdrien Destugues } VTermAttrMask;
276dae0a4e0SAdrien Destugues - PulkoMandy
277*1ec25517SAdrien Destugues int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs);
278dae0a4e0SAdrien Destugues - PulkoMandy
279*1ec25517SAdrien Destugues int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell);
280dae0a4e0SAdrien Destugues - PulkoMandy
281*1ec25517SAdrien Destugues int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos);
282dae0a4e0SAdrien Destugues - PulkoMandy
283*1ec25517SAdrien Destugues // ---------
284*1ec25517SAdrien Destugues // Utilities
285*1ec25517SAdrien Destugues // ---------
286dae0a4e0SAdrien Destugues - PulkoMandy
287*1ec25517SAdrien Destugues VTermValueType vterm_get_attr_type(VTermAttr attr);
288*1ec25517SAdrien Destugues VTermValueType vterm_get_prop_type(VTermProp prop);
289dae0a4e0SAdrien Destugues - PulkoMandy
290dae0a4e0SAdrien Destugues - PulkoMandy void vterm_scroll_rect(VTermRect rect,
291dae0a4e0SAdrien Destugues - PulkoMandy int downward,
292dae0a4e0SAdrien Destugues - PulkoMandy int rightward,
293dae0a4e0SAdrien Destugues - PulkoMandy int (*moverect)(VTermRect src, VTermRect dest, void *user),
294*1ec25517SAdrien Destugues int (*eraserect)(VTermRect rect, int selective, void *user),
295dae0a4e0SAdrien Destugues - PulkoMandy void *user);
296dae0a4e0SAdrien Destugues - PulkoMandy
297dae0a4e0SAdrien Destugues - PulkoMandy void vterm_copy_cells(VTermRect dest,
298dae0a4e0SAdrien Destugues - PulkoMandy VTermRect src,
299dae0a4e0SAdrien Destugues - PulkoMandy void (*copycell)(VTermPos dest, VTermPos src, void *user),
300dae0a4e0SAdrien Destugues - PulkoMandy void *user);
301dae0a4e0SAdrien Destugues - PulkoMandy
302dae0a4e0SAdrien Destugues - PulkoMandy #endif
303