39#define VT_COLOR_DEFAULT 0u
40#define VT_COLOR_INDEX 0x01000000u
41#define VT_COLOR_RGB 0x02000000u
42#define VT_COLOR_KIND(c) ((c) & 0xFF000000u)
45#define VT_BOLD 0x0001u
47#define VT_ITALIC 0x0004u
48#define VT_UNDERLINE 0x0008u
49#define VT_BLINK 0x0010u
50#define VT_INVERSE 0x0020u
51#define VT_HIDDEN 0x0040u
52#define VT_STRIKE 0x0080u
93typedef void (*
vt_reply_t)(
const char *data,
size_t length,
void *user);
120 struct vt_private *
p;
126vt_t *
vt_new(
int cols,
int rows,
int scrollback);
169size_t vt_text(
const vt_t *
vt,
int x0,
int y0,
int x1,
int y1,
char *out,
size_t size);
199#define VT_MOD_SHIFT 0x01
200#define VT_MOD_ALT 0x02
201#define VT_MOD_CTRL 0x04
218int vt_text_key(
const char *text,
int mods,
char *out);
unsigned int uint32_t
Definition fb.h:17
NULL, size_t, ptrdiff_t, offsetof.
integer types of fixed width.
unsigned short uint16_t
Definition stdint.h:13
uint16_t attr
Definition vt.h:59
uint32_t bg
Definition vt.h:58
uint32_t fg
Definition vt.h:57
uint32_t ch
Definition vt.h:56
a line of cells: on the screen, or in the scrollback.
Definition vt.h:66
bool dirty
Definition vt.h:69
uint16_t cols
Definition vt.h:67
vt_cell_t cells[]
Definition vt.h:70
bool wrapped
Definition vt.h:68
char title[256]
Definition vt.h:115
int rows
Definition vt.h:101
bool focus_reports
Definition vt.h:113
bool alt_screen
Definition vt.h:107
vt_cursor_shape_t cursor_shape
Definition vt.h:106
bool bell
Definition vt.h:117
struct vt_private * p
Definition vt.h:120
int scrolled
Definition vt.h:118
bool bracketed_paste
Definition vt.h:110
int cols
Definition vt.h:100
bool reverse_video
Definition vt.h:114
bool app_cursor_keys
Definition vt.h:108
vt_mouse_mode_t mouse
Definition vt.h:111
bool mouse_sgr
Definition vt.h:112
int cursor_x
Definition vt.h:102
int cursor_y
Definition vt.h:103
bool cursor_visible
Definition vt.h:104
bool app_keypad
Definition vt.h:109
bool title_changed
Definition vt.h:116
bool cursor_blink
Definition vt.h:105
int vt_mouse(const vt_t *vt, vt_mouse_t kind, int button, int x, int y, int mods, char *out)
a mouse report for the program, if its mode asks for this one.
Definition vt.c:1553
const char * vt_paste_begin(const vt_t *vt)
what goes before and after pasted text: the bracketed paste marks when the program asked for them,...
Definition vt.c:1596
vt_cursor_shape_t
Definition vt.h:74
@ VT_CURSOR_BAR
Definition vt.h:77
@ VT_CURSOR_UNDERLINE
Definition vt.h:76
@ VT_CURSOR_BLOCK
Definition vt.h:75
size_t vt_text(const vt_t *vt, int x0, int y0, int x1, int y1, char *out, size_t size)
the text from (x0, y0) to (x1, y1), both included, as UTF-8; y as for vt_line.
Definition vt.c:1403
const char * vt_paste_end(const vt_t *vt)
Definition vt.c:1601
void vt_clean(vt_t *vt)
forget what changed: the app drew it
Definition vt.c:1359
void vt_write(vt_t *vt, const void *data, size_t length)
the bytes the program wrote.
Definition vt.c:1266
vt_mouse_t
Definition vt.h:221
@ VT_MOUSE_PRESS
Definition vt.h:222
@ VT_MOUSE_WHEEL_UP
Definition vt.h:225
@ VT_MOUSE_WHEEL_DOWN
Definition vt.h:226
@ VT_MOUSE_MOVE
Definition vt.h:224
@ VT_MOUSE_RELEASE
Definition vt.h:223
int vt_scrollback_lines(const vt_t *vt)
the lines in the scrollback now
Definition vt.c:1349
const vt_line_t * vt_line(const vt_t *vt, int y)
a line of the screen (0 to rows - 1), or of the scrollback (-1 is the newest line,...
Definition vt.c:1338
uint32_t vt_palette(int index)
the RGB colour of palette entry 0 to 255: the 16 colours of xterm, the 6x6x6 cube and the grey ramp.
Definition vt.c:1434
void vt_set_reply(vt_t *vt, vt_reply_t reply, void *user)
where the answers go (without it, they are dropped).
Definition vt.c:328
int vt_key(const vt_t *vt, vt_key_t key, int mods, char *out)
the bytes a key sends, as xterm sends them (the arrows follow DECCKM; with modifiers,...
Definition vt.c:1453
bool vt_line_dirty(const vt_t *vt, int y)
true if the screen line y changed since vt_clean
Definition vt.c:1354
int vt_text_key(const char *text, int mods, char *out)
the bytes typed text sends: Ctrl with a letter or one of []^_ and space gives the control character,...
Definition vt.c:1513
vt_key_t
Definition vt.h:179
@ VT_KEY_ESCAPE
Definition vt.h:193
@ VT_KEY_ENTER
Definition vt.h:190
@ VT_KEY_RIGHT
Definition vt.h:182
@ VT_KEY_TAB
Definition vt.h:191
@ VT_KEY_INSERT
Definition vt.h:186
@ VT_KEY_LEFT
Definition vt.h:183
@ VT_KEY_BACKSPACE
Definition vt.h:192
@ VT_KEY_F12
Definition vt.h:195
@ VT_KEY_END
Definition vt.h:185
@ VT_KEY_PAGE_DOWN
Definition vt.h:189
@ VT_KEY_F1
Definition vt.h:194
@ VT_KEY_PAGE_UP
Definition vt.h:188
@ VT_KEY_DOWN
Definition vt.h:181
@ VT_KEY_DELETE
Definition vt.h:187
@ VT_KEY_UP
Definition vt.h:180
@ VT_KEY_HOME
Definition vt.h:184
void(*) vt_reply_t(const char *data, size_t length, void *user)
where the terminal sends its answers (the cursor position, the device attributes): to the program,...
Definition vt.h:93
vt_mouse_mode_t
Definition vt.h:82
@ VT_MOUSE_CLICKS
Definition vt.h:84
@ VT_MOUSE_OFF
Definition vt.h:83
@ VT_MOUSE_DRAG
Definition vt.h:85
@ VT_MOUSE_MOTION
Definition vt.h:86
void vt_resize(vt_t *vt, int cols, int rows)
a new size.
Definition vt.c:1306
vt_t * vt_new(int cols, int rows, int scrollback)
a terminal of a size, with room for so many lines of scrollback.
Definition vt.c:288
void vt_free(vt_t *vt)
Definition vt.c:315
struct vt vt_t
Definition vt.h:95