Open History to see the last commit
1/**
2 * @file vt.h
3 *
4 * libghostty-vt - Virtual terminal emulator library
5 *
6 * This library provides functionality for parsing and handling terminal
7 * escape sequences as well as maintaining terminal state such as styles,
8 * cursor position, screen, scrollback, and more.
9 *
10 * The C ABI is stable from 1.0. See @ref stability for details.
11 */
12
13/** @example c-vt-hello/src/main.c
14 * The smallest complete program: create a terminal, write text with a color
15 * sequence in it, and print the screen. This is the program on the main page.
16 */
17
18/** @example c-vt-stream/src/main.c
19 * Feed VT sequences into a terminal, read the final screen back as plain text,
20 * and draw it with a render state. Start here for read-only tools like replay
21 * viewers and CI log viewers.
22 */
23
24/** @example c-vt-formatter/src/main.c
25 * Write text and cursor movement into a terminal, then stream the screen to
26 * stdout as plain text through a GhosttyWriter.
27 */
28
29/** @example c-vt-colors/src/main.c
30 * Set the default colors and palette, then read effective and default values
31 * as an OSC 10 override layers on top.
32 */
33
34/** @example c-vt-effects/src/main.c
35 * Register callbacks for what a program asks of the terminal: pty replies,
36 * the bell, title changes, OSC 52 clipboard reads and writes, and unknown
37 * sequences. You need these as soon as a real program runs in the terminal.
38 */
39
40/** @example c-vt-compression/src/main.c
41 * Compress scrollback while the terminal is idle.
42 */
43
44/** @example c-vt-snapshot/src/main.c
45 * Encode a terminal's full state and restore it three ways: in one shot, with
46 * scrollback kept compressed, and page by page. The page by page path gives
47 * you a terminal you can draw before the old history arrives.
48 */
49
50/** @example c-vt-grid-traverse/src/main.c
51 * Walk the whole grid cell by cell with grid refs, reading codepoints, row
52 * wrap state and styles.
53 */
54
55/** @example c-vt-grid-ref-tracked/src/main.c
56 * Keep a reference to one cell while the terminal scrolls under it.
57 */
58
59/** @example c-vt-render/src/main.c
60 * Draw a frame from a render state: check what's dirty, walk the rows and
61 * cells, and read styles, colors, the cursor and the selection. Use this when
62 * you render the terminal yourself.
63 */
64
65/** @example c-vt-search/src/main.c
66 * Search the terminal for a string, step through the matches like a find bar,
67 * and read the viewport matches to draw highlights.
68 */
69
70/** @example c-vt-selection/src/main.c
71 * Select a word, a line, a command's output or the whole screen, then format
72 * each selection as text. The line and output selections use OSC 133 prompt
73 * markers.
74 */
75
76/** @example c-vt-selection-gesture/src/main.c
77 * Feed press, drag, release and deep press events to
78 * ghostty_selection_gesture_event() and get back selections you can show or
79 * copy.
80 */
81
82/** @example c-vt-kitty-graphics/src/main.c
83 * Accept images sent with the Kitty Graphics Protocol and find out what to
84 * draw. It installs a stand-in PNG decoder, reads placements from the render
85 * state, and plays an animation.
86 */
87
88/** @example c-vt-encode-key/src/main.c
89 * Encode Ctrl+C as an escape sequence with the Kitty keyboard protocol.
90 */
91
92/** @example c-vt-encode-mouse/src/main.c
93 * Encode a left button press at a pixel position as an SGR mouse sequence.
94 */
95
96/** @example c-vt-encode-focus/src/main.c
97 * Encode a focus gained event as CSI I, for programs that turn on focus
98 * reporting (mode 1004).
99 */
100
101/** @example c-vt-paste/src/main.c
102 * Paste into a terminal with ghostty_terminal_paste(): plain text, bracketed
103 * paste (mode 2004), the unsafe-paste confirmation, and Kitty paste events
104 * (mode 5522). It also checks paste safety and encodes paste data without a
105 * terminal.
106 */
107
108/** @example c-vt-osc/src/main.c
109 * Parse an OSC sequence and read the window title out of it.
110 */
111
112/** @example c-vt-sgr/src/main.c
113 * Parse SGR sequences into text attributes, including a real one from Kakoune
114 * with a curly underline and RGB colors.
115 */
116
117/** @example c-vt-modes/src/main.c
118 * Pack DEC and ANSI mode numbers into a GhosttyMode and encode a DECRPM
119 * report.
120 */
121
122/** @example c-vt-color-scheme/src/main.c
123 * Encode a color scheme report, the reply to a CSI ? 996 n query.
124 */
125
126/** @example c-vt-size-report/src/main.c
127 * Encode an in-band size report (mode 2048) from the grid and cell size.
128 */
129
130/** @example c-vt-allocator/src/main.c
131 * Run a terminal on your own allocator, built on `malloc` and `free`. It
132 * counts live bytes to check that the terminal frees everything.
133 */
134
135/** @example c-vt-build-info/src/main.c
136 * Query build options like SIMD and Kitty graphics, then check that the
137 * loaded library matches the headers you compiled against.
138 */
139
140/** @example c-vt-cmake/src/main.c
141 * Build and link libghostty-vt from a CMake project with `FetchContent`.
142 */
143
144/** @example c-vt-cmake-static/src/main.c
145 * Build and statically link libghostty-vt from a CMake project with
146 * `FetchContent`.
147 */
148
149/** @example c-vt-cmake-cross/src/main.c
150 * Cross-compile and statically link libghostty-vt from CMake with
151 * `ghostty_vt_add_target()`. The default target is a different OS from your
152 * host.
153 */
154
155/** @example c-vt-static/src/main.c
156 * Statically link libghostty-vt from a Zig build with the `ghostty-vt-static`
157 * artifact. The program is the same as c-vt-osc.
158 */
159#ifndef GHOSTTY_VT_H
160#define GHOSTTY_VT_H
161
162#ifdef __cplusplus
163extern "C" {
164#endif
165
166#include <ghostty/vt/version.h>
167#include <ghostty/vt/types.h>
168#include <ghostty/vt/allocator.h>
169#include <ghostty/vt/build_info.h>
170#include <ghostty/vt/color.h>
171#include <ghostty/vt/color_scheme.h>
172#include <ghostty/vt/device.h>
173#include <ghostty/vt/focus.h>
174#include <ghostty/vt/formatter.h>
175#include <ghostty/vt/render.h>
176#include <ghostty/vt/terminal.h>
177#include <ghostty/vt/grid_ref.h>
178#include <ghostty/vt/grid_ref_tracked.h>
179#include <ghostty/vt/io.h>
180#include <ghostty/vt/osc.h>
181#include <ghostty/vt/sgr.h>
182#include <ghostty/vt/style.h>
183#include <ghostty/vt/sys.h>
184#include <ghostty/vt/key.h>
185#include <ghostty/vt/kitty_graphics.h>
186#include <ghostty/vt/modes.h>
187#include <ghostty/vt/mouse.h>
188#include <ghostty/vt/paste.h>
189#include <ghostty/vt/point.h>
190#include <ghostty/vt/screen.h>
191#include <ghostty/vt/search.h>
192#include <ghostty/vt/selection.h>
193#include <ghostty/vt/size_report.h>
194#include <ghostty/vt/snapshot.h>
195#include <ghostty/vt/unicode.h>
196#include <ghostty/vt/wasm.h>
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif /* GHOSTTY_VT_H */