@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
h 157 lines 5.83 KB
Raw
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 * WARNING: This is an incomplete, work-in-progress API. It is not yet
11 * stable and is definitely going to change.
12 */
13
14 /**
15 * @mainpage libghostty-vt - Virtual Terminal Emulator Library
16 *
17 * libghostty-vt is a C library which implements a modern terminal emulator,
18 * extracted from the [Ghostty](https://ghostty.org) terminal emulator.
19 *
20 * libghostty-vt contains the logic for handling the core parts of a terminal
21 * emulator: parsing terminal escape sequences, maintaining terminal state,
22 * encoding input events, etc. It can handle scrollback, line wrapping,
23 * reflow on resize, and more.
24 *
25 * @warning This library is currently in development and the API is not yet stable.
26 * Breaking changes are expected in future versions. Use with caution in production code.
27 *
28 * @section groups_sec API Reference
29 *
30 * The API is organized into the following groups:
31 * - @ref terminal "Terminal" - Complete terminal emulator state and rendering
32 * - @ref render "Render State" - Incremental render state updates for custom renderers
33 * - @ref formatter "Formatter" - Format terminal content as plain text, VT sequences, or HTML
34 * - @ref osc "OSC Parser" - Parse OSC (Operating System Command) sequences
35 * - @ref sgr "SGR Parser" - Parse SGR (Select Graphic Rendition) sequences
36 * - @ref paste "Paste Utilities" - Validate paste data safety
37 * - @ref unicode "Unicode Utilities" - Codepoint properties for text layout
38 * - @ref build_info "Build Info" - Query compile-time build configuration
39 * - @ref allocator "Memory Management" - Memory management and custom allocators
40 * - @ref wasm "WebAssembly Utilities" - WebAssembly convenience functions
41 *
42 * Encoding related APIs:
43 * - @ref focus "Focus Encoding" - Encode focus in/out events into terminal sequences
44 * - @ref key "Key Encoding" - Encode key events into terminal sequences
45 * - @ref mouse "Mouse Encoding" - Encode mouse events into terminal sequences
46 *
47 * @section examples_sec Examples
48 *
49 * Complete working examples:
50 * - @ref c-vt-build-info/src/main.c - Build info query example
51 * - @ref c-vt/src/main.c - OSC parser example
52 * - @ref c-vt-encode-key/src/main.c - Key encoding example
53 * - @ref c-vt-encode-mouse/src/main.c - Mouse encoding example
54 * - @ref c-vt-paste/src/main.c - Paste safety check example
55 * - @ref c-vt-sgr/src/main.c - SGR parser example
56 * - @ref c-vt-formatter/src/main.c - Terminal formatter example
57 * - @ref c-vt-grid-traverse/src/main.c - Grid traversal example using grid refs
58 * - @ref c-vt-grid-ref-tracked/src/main.c - Tracked grid ref example
59 *
60 */
61
62 /** @example c-vt-build-info/src/main.c
63 * This example demonstrates how to query compile-time build configuration
64 * such as SIMD support, Kitty graphics, and tmux control mode availability.
65 */
66
67 /** @example c-vt/src/main.c
68 * This example demonstrates how to use the OSC parser to parse an OSC sequence,
69 * extract command information, and retrieve command-specific data like window titles.
70 */
71
72 /** @example c-vt-encode-key/src/main.c
73 * This example demonstrates how to use the key encoder to convert key events
74 * into terminal escape sequences using the Kitty keyboard protocol.
75 */
76
77 /** @example c-vt-encode-mouse/src/main.c
78 * This example demonstrates how to use the mouse encoder to convert mouse events
79 * into terminal escape sequences using the SGR mouse format.
80 */
81
82 /** @example c-vt-paste/src/main.c
83 * This example demonstrates how to use the paste utilities to check if
84 * paste data is safe before sending it to the terminal.
85 */
86
87 /** @example c-vt-sgr/src/main.c
88 * This example demonstrates how to use the SGR parser to parse terminal
89 * styling sequences and extract text attributes like colors and underline styles.
90 */
91
92 /** @example c-vt-formatter/src/main.c
93 * This example demonstrates how to use the terminal and formatter APIs to
94 * create a terminal, write VT-encoded content into it, and format the screen
95 * contents as plain text.
96 */
97
98 /** @example c-vt-grid-traverse/src/main.c
99 * This example demonstrates how to traverse the entire terminal grid using
100 * grid refs to inspect cell codepoints, row wrap state, and cell styles.
101 */
102
103 /** @example c-vt-grid-ref-tracked/src/main.c
104 * This example demonstrates how to track a grid ref as the terminal scrolls,
105 * detect when it loses its value, and move it to a new point.
106 */
107
108 /** @example c-vt-selection-gesture/src/main.c
109 * This example demonstrates how to use synthetic selection gesture events to
110 * derive drag and deep-press selection snapshots.
111 */
112
113 /** @example c-vt-kitty-graphics/src/main.c
114 * This example demonstrates how to use the system interface to install a
115 * PNG decoder callback and send a Kitty Graphics Protocol image.
116 */
117
118 #ifndef GHOSTTY_VT_H
119 #define GHOSTTY_VT_H
120
121 #ifdef __cplusplus
122 extern "C" {
123 #endif
124
125 #include <ghostty/vt/types.h>
126 #include <ghostty/vt/allocator.h>
127 #include <ghostty/vt/build_info.h>
128 #include <ghostty/vt/color.h>
129 #include <ghostty/vt/color_scheme.h>
130 #include <ghostty/vt/device.h>
131 #include <ghostty/vt/focus.h>
132 #include <ghostty/vt/formatter.h>
133 #include <ghostty/vt/render.h>
134 #include <ghostty/vt/terminal.h>
135 #include <ghostty/vt/grid_ref.h>
136 #include <ghostty/vt/grid_ref_tracked.h>
137 #include <ghostty/vt/osc.h>
138 #include <ghostty/vt/sgr.h>
139 #include <ghostty/vt/style.h>
140 #include <ghostty/vt/sys.h>
141 #include <ghostty/vt/key.h>
142 #include <ghostty/vt/kitty_graphics.h>
143 #include <ghostty/vt/modes.h>
144 #include <ghostty/vt/mouse.h>
145 #include <ghostty/vt/paste.h>
146 #include <ghostty/vt/point.h>
147 #include <ghostty/vt/screen.h>
148 #include <ghostty/vt/selection.h>
149 #include <ghostty/vt/size_report.h>
150 #include <ghostty/vt/unicode.h>
151 #include <ghostty/vt/wasm.h>
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif /* GHOSTTY_VT_H */