Skip to main content

libghostty_vt_sys/
bindings.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3pub const GHOSTTY_COLOR_NAMED_BLACK: u32 = 0;
4pub const GHOSTTY_COLOR_NAMED_RED: u32 = 1;
5pub const GHOSTTY_COLOR_NAMED_GREEN: u32 = 2;
6pub const GHOSTTY_COLOR_NAMED_YELLOW: u32 = 3;
7pub const GHOSTTY_COLOR_NAMED_BLUE: u32 = 4;
8pub const GHOSTTY_COLOR_NAMED_MAGENTA: u32 = 5;
9pub const GHOSTTY_COLOR_NAMED_CYAN: u32 = 6;
10pub const GHOSTTY_COLOR_NAMED_WHITE: u32 = 7;
11pub const GHOSTTY_COLOR_NAMED_BRIGHT_BLACK: u32 = 8;
12pub const GHOSTTY_COLOR_NAMED_BRIGHT_RED: u32 = 9;
13pub const GHOSTTY_COLOR_NAMED_BRIGHT_GREEN: u32 = 10;
14pub const GHOSTTY_COLOR_NAMED_BRIGHT_YELLOW: u32 = 11;
15pub const GHOSTTY_COLOR_NAMED_BRIGHT_BLUE: u32 = 12;
16pub const GHOSTTY_COLOR_NAMED_BRIGHT_MAGENTA: u32 = 13;
17pub const GHOSTTY_COLOR_NAMED_BRIGHT_CYAN: u32 = 14;
18pub const GHOSTTY_COLOR_NAMED_BRIGHT_WHITE: u32 = 15;
19pub const GHOSTTY_DA_CONFORMANCE_VT100: u32 = 1;
20pub const GHOSTTY_DA_CONFORMANCE_VT101: u32 = 1;
21pub const GHOSTTY_DA_CONFORMANCE_VT102: u32 = 6;
22pub const GHOSTTY_DA_CONFORMANCE_VT125: u32 = 12;
23pub const GHOSTTY_DA_CONFORMANCE_VT131: u32 = 7;
24pub const GHOSTTY_DA_CONFORMANCE_VT132: u32 = 4;
25pub const GHOSTTY_DA_CONFORMANCE_VT220: u32 = 62;
26pub const GHOSTTY_DA_CONFORMANCE_VT240: u32 = 62;
27pub const GHOSTTY_DA_CONFORMANCE_VT320: u32 = 63;
28pub const GHOSTTY_DA_CONFORMANCE_VT340: u32 = 63;
29pub const GHOSTTY_DA_CONFORMANCE_VT420: u32 = 64;
30pub const GHOSTTY_DA_CONFORMANCE_VT510: u32 = 65;
31pub const GHOSTTY_DA_CONFORMANCE_VT520: u32 = 65;
32pub const GHOSTTY_DA_CONFORMANCE_VT525: u32 = 65;
33pub const GHOSTTY_DA_CONFORMANCE_LEVEL_2: u32 = 62;
34pub const GHOSTTY_DA_CONFORMANCE_LEVEL_3: u32 = 63;
35pub const GHOSTTY_DA_CONFORMANCE_LEVEL_4: u32 = 64;
36pub const GHOSTTY_DA_CONFORMANCE_LEVEL_5: u32 = 65;
37pub const GHOSTTY_DA_FEATURE_COLUMNS_132: u32 = 1;
38pub const GHOSTTY_DA_FEATURE_PRINTER: u32 = 2;
39pub const GHOSTTY_DA_FEATURE_REGIS: u32 = 3;
40pub const GHOSTTY_DA_FEATURE_SIXEL: u32 = 4;
41pub const GHOSTTY_DA_FEATURE_SELECTIVE_ERASE: u32 = 6;
42pub const GHOSTTY_DA_FEATURE_USER_DEFINED_KEYS: u32 = 8;
43pub const GHOSTTY_DA_FEATURE_NATIONAL_REPLACEMENT: u32 = 9;
44pub const GHOSTTY_DA_FEATURE_TECHNICAL_CHARACTERS: u32 = 15;
45pub const GHOSTTY_DA_FEATURE_LOCATOR: u32 = 16;
46pub const GHOSTTY_DA_FEATURE_TERMINAL_STATE: u32 = 17;
47pub const GHOSTTY_DA_FEATURE_WINDOWING: u32 = 18;
48pub const GHOSTTY_DA_FEATURE_HORIZONTAL_SCROLLING: u32 = 21;
49pub const GHOSTTY_DA_FEATURE_ANSI_COLOR: u32 = 22;
50pub const GHOSTTY_DA_FEATURE_RECTANGULAR_EDITING: u32 = 28;
51pub const GHOSTTY_DA_FEATURE_ANSI_TEXT_LOCATOR: u32 = 29;
52pub const GHOSTTY_DA_FEATURE_CLIPBOARD: u32 = 52;
53pub const GHOSTTY_DA_DEVICE_TYPE_VT100: u32 = 0;
54pub const GHOSTTY_DA_DEVICE_TYPE_VT220: u32 = 1;
55pub const GHOSTTY_DA_DEVICE_TYPE_VT240: u32 = 2;
56pub const GHOSTTY_DA_DEVICE_TYPE_VT330: u32 = 18;
57pub const GHOSTTY_DA_DEVICE_TYPE_VT340: u32 = 19;
58pub const GHOSTTY_DA_DEVICE_TYPE_VT320: u32 = 24;
59pub const GHOSTTY_DA_DEVICE_TYPE_VT382: u32 = 32;
60pub const GHOSTTY_DA_DEVICE_TYPE_VT420: u32 = 41;
61pub const GHOSTTY_DA_DEVICE_TYPE_VT510: u32 = 61;
62pub const GHOSTTY_DA_DEVICE_TYPE_VT520: u32 = 64;
63pub const GHOSTTY_DA_DEVICE_TYPE_VT525: u32 = 65;
64pub const GHOSTTY_MODS_SHIFT: u32 = 1;
65pub const GHOSTTY_MODS_CTRL: u32 = 2;
66pub const GHOSTTY_MODS_ALT: u32 = 4;
67pub const GHOSTTY_MODS_SUPER: u32 = 8;
68pub const GHOSTTY_MODS_CAPS_LOCK: u32 = 16;
69pub const GHOSTTY_MODS_NUM_LOCK: u32 = 32;
70pub const GHOSTTY_MODS_SHIFT_SIDE: u32 = 64;
71pub const GHOSTTY_MODS_CTRL_SIDE: u32 = 128;
72pub const GHOSTTY_MODS_ALT_SIDE: u32 = 256;
73pub const GHOSTTY_MODS_SUPER_SIDE: u32 = 512;
74pub const GHOSTTY_KITTY_KEY_DISABLED: u32 = 0;
75pub const GHOSTTY_KITTY_KEY_DISAMBIGUATE: u32 = 1;
76pub const GHOSTTY_KITTY_KEY_REPORT_EVENTS: u32 = 2;
77pub const GHOSTTY_KITTY_KEY_REPORT_ALTERNATES: u32 = 4;
78pub const GHOSTTY_KITTY_KEY_REPORT_ALL: u32 = 8;
79pub const GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED: u32 = 16;
80pub const GHOSTTY_KITTY_KEY_ALL: u32 = 31;
81#[doc = " Operation completed successfully"]
82pub const GhosttyResult_GHOSTTY_SUCCESS: GhosttyResult = 0;
83#[doc = " Operation failed due to failed allocation"]
84pub const GhosttyResult_GHOSTTY_OUT_OF_MEMORY: GhosttyResult = -1;
85#[doc = " Operation failed due to invalid value"]
86pub const GhosttyResult_GHOSTTY_INVALID_VALUE: GhosttyResult = -2;
87#[doc = " Operation failed because the provided buffer was too small"]
88pub const GhosttyResult_GHOSTTY_OUT_OF_SPACE: GhosttyResult = -3;
89#[doc = " Result codes for libghostty-vt operations."]
90pub type GhosttyResult = ::std::os::raw::c_int;
91#[doc = " A borrowed byte string (pointer + length).\n\n The memory is not owned by this struct. The pointer is only valid\n for the lifetime documented by the API that produces or consumes it."]
92#[repr(C)]
93#[derive(Debug, Copy, Clone)]
94pub struct GhosttyString {
95    #[doc = " Pointer to the string bytes."]
96    pub ptr: *const u8,
97    #[doc = " Length of the string in bytes."]
98    pub len: usize,
99}
100#[allow(clippy::unnecessary_operation, clippy::identity_op)]
101const _: () = {
102    ["Size of GhosttyString"][::std::mem::size_of::<GhosttyString>() - 16usize];
103    ["Alignment of GhosttyString"][::std::mem::align_of::<GhosttyString>() - 8usize];
104    ["Offset of field: GhosttyString::ptr"][::std::mem::offset_of!(GhosttyString, ptr) - 0usize];
105    ["Offset of field: GhosttyString::len"][::std::mem::offset_of!(GhosttyString, len) - 8usize];
106};
107impl Default for GhosttyString {
108    fn default() -> Self {
109        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
110        unsafe {
111            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
112            s.assume_init()
113        }
114    }
115}
116#[doc = " Function table for custom memory allocator operations.\n\n This vtable defines the interface for a custom memory allocator. All\n function pointers must be valid and non-NULL.\n\n @ingroup allocator\n\n If you're not going to use a custom allocator, you can ignore all of\n this. All functions that take an allocator pointer allow NULL to use a\n default allocator.\n\n The interface is based on the Zig allocator interface. I'll say up front\n that it is easy to look at this interface and think \"wow, this is really\n overcomplicated\". The reason for this complexity is well thought out by\n the Zig folks, and it enables a diverse set of allocation strategies\n as shown by the Zig ecosystem. As a consolation, please note that many\n of the arguments are only needed for advanced use cases and can be\n safely ignored in simple implementations. For example, if you look at\n the Zig implementation of the libc allocator in `lib/std/heap.zig`\n (search for CAllocator), you'll see it is very simple.\n\n We chose to align with the Zig allocator interface because:\n\n   1. It is a proven interface that serves a wide variety of use cases\n      in the real world via the Zig ecosystem. It's shown to work.\n\n   2. Our core implementation itself is Zig, and this lets us very\n      cheaply and easily convert between C and Zig allocators.\n\n NOTE(mitchellh): In the future, we can have default implementations of\n resize/remap and allow those to be null."]
117#[repr(C)]
118#[derive(Debug, Default, Copy, Clone)]
119pub struct GhosttyAllocatorVtable {
120    #[doc = " Return a pointer to `len` bytes with specified `alignment`, or return\n `NULL` indicating the allocation failed.\n\n @param ctx The allocator context\n @param len Number of bytes to allocate\n @param alignment Required alignment for the allocation. Guaranteed to\n   be a power of two between 1 and 16 inclusive.\n @param ret_addr First return address of the allocation call stack (0 if not provided)\n @return Pointer to allocated memory, or NULL if allocation failed"]
121    pub alloc: ::std::option::Option<
122        unsafe extern "C" fn(
123            ctx: *mut ::std::os::raw::c_void,
124            len: usize,
125            alignment: u8,
126            ret_addr: usize,
127        ) -> *mut ::std::os::raw::c_void,
128    >,
129    #[doc = " Attempt to expand or shrink memory in place.\n\n `memory_len` must equal the length requested from the most recent\n successful call to `alloc`, `resize`, or `remap`. `alignment` must\n equal the same value that was passed as the `alignment` parameter to\n the original `alloc` call.\n\n `new_len` must be greater than zero.\n\n @param ctx The allocator context\n @param memory Pointer to the memory block to resize\n @param memory_len Current size of the memory block\n @param alignment Alignment (must match original allocation)\n @param new_len New requested size\n @param ret_addr First return address of the allocation call stack (0 if not provided)\n @return true if resize was successful in-place, false if relocation would be required"]
130    pub resize: ::std::option::Option<
131        unsafe extern "C" fn(
132            ctx: *mut ::std::os::raw::c_void,
133            memory: *mut ::std::os::raw::c_void,
134            memory_len: usize,
135            alignment: u8,
136            new_len: usize,
137            ret_addr: usize,
138        ) -> bool,
139    >,
140    #[doc = " Attempt to expand or shrink memory, allowing relocation.\n\n `memory_len` must equal the length requested from the most recent\n successful call to `alloc`, `resize`, or `remap`. `alignment` must\n equal the same value that was passed as the `alignment` parameter to\n the original `alloc` call.\n\n A non-`NULL` return value indicates the resize was successful. The\n allocation may have same address, or may have been relocated. In either\n case, the allocation now has size of `new_len`. A `NULL` return value\n indicates that the resize would be equivalent to allocating new memory,\n copying the bytes from the old memory, and then freeing the old memory.\n In such case, it is more efficient for the caller to perform the copy.\n\n `new_len` must be greater than zero.\n\n @param ctx The allocator context\n @param memory Pointer to the memory block to remap\n @param memory_len Current size of the memory block\n @param alignment Alignment (must match original allocation)\n @param new_len New requested size\n @param ret_addr First return address of the allocation call stack (0 if not provided)\n @return Pointer to resized memory (may be relocated), or NULL if manual copy is needed"]
141    pub remap: ::std::option::Option<
142        unsafe extern "C" fn(
143            ctx: *mut ::std::os::raw::c_void,
144            memory: *mut ::std::os::raw::c_void,
145            memory_len: usize,
146            alignment: u8,
147            new_len: usize,
148            ret_addr: usize,
149        ) -> *mut ::std::os::raw::c_void,
150    >,
151    #[doc = " Free and invalidate a region of memory.\n\n `memory_len` must equal the length requested from the most recent\n successful call to `alloc`, `resize`, or `remap`. `alignment` must\n equal the same value that was passed as the `alignment` parameter to\n the original `alloc` call.\n\n @param ctx The allocator context\n @param memory Pointer to the memory block to free\n @param memory_len Size of the memory block\n @param alignment Alignment (must match original allocation)\n @param ret_addr First return address of the allocation call stack (0 if not provided)"]
152    pub free: ::std::option::Option<
153        unsafe extern "C" fn(
154            ctx: *mut ::std::os::raw::c_void,
155            memory: *mut ::std::os::raw::c_void,
156            memory_len: usize,
157            alignment: u8,
158            ret_addr: usize,
159        ),
160    >,
161}
162#[allow(clippy::unnecessary_operation, clippy::identity_op)]
163const _: () = {
164    ["Size of GhosttyAllocatorVtable"][::std::mem::size_of::<GhosttyAllocatorVtable>() - 32usize];
165    ["Alignment of GhosttyAllocatorVtable"]
166        [::std::mem::align_of::<GhosttyAllocatorVtable>() - 8usize];
167    ["Offset of field: GhosttyAllocatorVtable::alloc"]
168        [::std::mem::offset_of!(GhosttyAllocatorVtable, alloc) - 0usize];
169    ["Offset of field: GhosttyAllocatorVtable::resize"]
170        [::std::mem::offset_of!(GhosttyAllocatorVtable, resize) - 8usize];
171    ["Offset of field: GhosttyAllocatorVtable::remap"]
172        [::std::mem::offset_of!(GhosttyAllocatorVtable, remap) - 16usize];
173    ["Offset of field: GhosttyAllocatorVtable::free"]
174        [::std::mem::offset_of!(GhosttyAllocatorVtable, free) - 24usize];
175};
176#[doc = " Custom memory allocator.\n\n For functions that take an allocator pointer, a NULL pointer indicates\n that the default allocator should be used. The default allocator will\n be libc malloc/free if we're linking to libc. If libc isn't linked,\n a custom allocator is used (currently Zig's SMP allocator).\n\n @ingroup allocator\n\n Usage example:\n @code\n GhosttyAllocator allocator = {\n     .vtable = &my_allocator_vtable,\n     .ctx = my_allocator_state\n };\n @endcode"]
177#[repr(C)]
178#[derive(Debug, Copy, Clone)]
179pub struct GhosttyAllocator {
180    #[doc = " Opaque context pointer passed to all vtable functions.\n This allows the allocator implementation to maintain state\n or reference external resources needed for memory management."]
181    pub ctx: *mut ::std::os::raw::c_void,
182    #[doc = " Pointer to the allocator's vtable containing function pointers\n for memory operations (alloc, resize, remap, free)."]
183    pub vtable: *const GhosttyAllocatorVtable,
184}
185#[allow(clippy::unnecessary_operation, clippy::identity_op)]
186const _: () = {
187    ["Size of GhosttyAllocator"][::std::mem::size_of::<GhosttyAllocator>() - 16usize];
188    ["Alignment of GhosttyAllocator"][::std::mem::align_of::<GhosttyAllocator>() - 8usize];
189    ["Offset of field: GhosttyAllocator::ctx"]
190        [::std::mem::offset_of!(GhosttyAllocator, ctx) - 0usize];
191    ["Offset of field: GhosttyAllocator::vtable"]
192        [::std::mem::offset_of!(GhosttyAllocator, vtable) - 8usize];
193};
194impl Default for GhosttyAllocator {
195    fn default() -> Self {
196        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
197        unsafe {
198            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
199            s.assume_init()
200        }
201    }
202}
203unsafe extern "C" {
204    #[doc = " Allocate a buffer of `len` bytes.\n\n Uses the provided allocator, or the default allocator if NULL is passed.\n The returned buffer must be freed with ghostty_free() using the same\n allocator.\n\n @param allocator Pointer to the allocator to use, or NULL for the default\n @param len Number of bytes to allocate\n @return Pointer to the allocated buffer, or NULL if allocation failed\n\n @ingroup allocator"]
205    pub fn ghostty_alloc(allocator: *const GhosttyAllocator, len: usize) -> *mut u8;
206}
207unsafe extern "C" {
208    #[doc = " Free memory that was allocated by a libghostty-vt function.\n\n Use this to free buffers returned by functions such as\n ghostty_formatter_format_alloc(). Pass the same allocator that was\n used for the allocation, or NULL if the default allocator was used.\n\n On platforms where the library's internal allocator differs from the\n consumer's C runtime (e.g. Windows, where Zig's libc and MSVC's CRT\n maintain separate heaps), calling the standard C free() on memory\n allocated by the library causes undefined behavior. This function\n guarantees the correct allocator is used regardless of platform.\n\n It is safe to pass a NULL pointer; the call is a no-op in that case.\n\n @param allocator Pointer to the allocator that was used to allocate the\n   memory, or NULL if the default allocator was used\n @param ptr Pointer to the memory to free (may be NULL)\n @param len Length of the allocation in bytes (must match the original\n   allocation size)\n\n @ingroup allocator"]
209    pub fn ghostty_free(allocator: *const GhosttyAllocator, ptr: *mut u8, len: usize);
210}
211pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_DEBUG: GhosttyOptimizeMode = 0;
212pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_RELEASE_SAFE: GhosttyOptimizeMode = 1;
213pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_RELEASE_SMALL: GhosttyOptimizeMode = 2;
214pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_RELEASE_FAST: GhosttyOptimizeMode = 3;
215#[doc = " Build optimization mode."]
216pub type GhosttyOptimizeMode = ::std::os::raw::c_uint;
217#[doc = " Invalid data type. Never results in any data extraction."]
218pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_INVALID: GhosttyBuildInfo = 0;
219#[doc = " Whether SIMD-accelerated code paths are enabled.\n\n Output type: bool *"]
220pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_SIMD: GhosttyBuildInfo = 1;
221#[doc = " Whether Kitty graphics protocol support is available.\n\n Output type: bool *"]
222pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_KITTY_GRAPHICS: GhosttyBuildInfo = 2;
223#[doc = " Whether tmux control mode support is available.\n\n Output type: bool *"]
224pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_TMUX_CONTROL_MODE: GhosttyBuildInfo = 3;
225#[doc = " The optimization mode the library was built with.\n\n Output type: GhosttyOptimizeMode *"]
226pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_OPTIMIZE: GhosttyBuildInfo = 4;
227#[doc = " Build info data types that can be queried.\n\n Each variant documents the expected output pointer type."]
228pub type GhosttyBuildInfo = ::std::os::raw::c_uint;
229unsafe extern "C" {
230    #[doc = " Query a compile-time build configuration value.\n\n The caller must pass a pointer to the correct output type for the\n requested data (see GhosttyBuildInfo variants for types).\n\n @param data The build info field to query\n @param out Pointer to store the result (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the\n         data type is invalid\n\n @ingroup build_info"]
231    pub fn ghostty_build_info(
232        data: GhosttyBuildInfo,
233        out: *mut ::std::os::raw::c_void,
234    ) -> GhosttyResult;
235}
236#[doc = " RGB color value.\n\n @ingroup sgr"]
237#[repr(C)]
238#[derive(Debug, Default, Copy, Clone)]
239pub struct GhosttyColorRgb {
240    #[doc = "< Red component (0-255)"]
241    pub r: u8,
242    #[doc = "< Green component (0-255)"]
243    pub g: u8,
244    #[doc = "< Blue component (0-255)"]
245    pub b: u8,
246}
247#[allow(clippy::unnecessary_operation, clippy::identity_op)]
248const _: () = {
249    ["Size of GhosttyColorRgb"][::std::mem::size_of::<GhosttyColorRgb>() - 3usize];
250    ["Alignment of GhosttyColorRgb"][::std::mem::align_of::<GhosttyColorRgb>() - 1usize];
251    ["Offset of field: GhosttyColorRgb::r"][::std::mem::offset_of!(GhosttyColorRgb, r) - 0usize];
252    ["Offset of field: GhosttyColorRgb::g"][::std::mem::offset_of!(GhosttyColorRgb, g) - 1usize];
253    ["Offset of field: GhosttyColorRgb::b"][::std::mem::offset_of!(GhosttyColorRgb, b) - 2usize];
254};
255#[doc = " Palette color index (0-255).\n\n @ingroup sgr"]
256pub type GhosttyColorPaletteIndex = u8;
257unsafe extern "C" {
258    #[doc = " Get the RGB color components.\n\n This function extracts the individual red, green, and blue components\n from a GhosttyColorRgb value. Primarily useful in WebAssembly environments\n where accessing struct fields directly is difficult.\n\n @param color The RGB color value\n @param r Pointer to store the red component (0-255)\n @param g Pointer to store the green component (0-255)\n @param b Pointer to store the blue component (0-255)\n\n @ingroup sgr"]
259    pub fn ghostty_color_rgb_get(color: GhosttyColorRgb, r: *mut u8, g: *mut u8, b: *mut u8);
260}
261pub const GhosttyColorScheme_GHOSTTY_COLOR_SCHEME_LIGHT: GhosttyColorScheme = 0;
262pub const GhosttyColorScheme_GHOSTTY_COLOR_SCHEME_DARK: GhosttyColorScheme = 1;
263#[doc = " Color scheme reported in response to a CSI ? 996 n query.\n\n @ingroup terminal"]
264pub type GhosttyColorScheme = ::std::os::raw::c_uint;
265#[doc = " Primary device attributes (DA1) response data.\n\n Returned as part of GhosttyDeviceAttributes in response to a CSI c query.\n The conformance_level is the Pp parameter and features contains the Ps\n feature codes.\n\n @ingroup terminal"]
266#[repr(C)]
267#[derive(Debug, Copy, Clone)]
268pub struct GhosttyDeviceAttributesPrimary {
269    #[doc = " Conformance level (Pp parameter). E.g. 62 for VT220."]
270    pub conformance_level: u16,
271    #[doc = " DA1 feature codes. Only the first num_features entries are valid."]
272    pub features: [u16; 64usize],
273    #[doc = " Number of valid entries in the features array."]
274    pub num_features: usize,
275}
276#[allow(clippy::unnecessary_operation, clippy::identity_op)]
277const _: () = {
278    ["Size of GhosttyDeviceAttributesPrimary"]
279        [::std::mem::size_of::<GhosttyDeviceAttributesPrimary>() - 144usize];
280    ["Alignment of GhosttyDeviceAttributesPrimary"]
281        [::std::mem::align_of::<GhosttyDeviceAttributesPrimary>() - 8usize];
282    ["Offset of field: GhosttyDeviceAttributesPrimary::conformance_level"]
283        [::std::mem::offset_of!(GhosttyDeviceAttributesPrimary, conformance_level) - 0usize];
284    ["Offset of field: GhosttyDeviceAttributesPrimary::features"]
285        [::std::mem::offset_of!(GhosttyDeviceAttributesPrimary, features) - 2usize];
286    ["Offset of field: GhosttyDeviceAttributesPrimary::num_features"]
287        [::std::mem::offset_of!(GhosttyDeviceAttributesPrimary, num_features) - 136usize];
288};
289impl Default for GhosttyDeviceAttributesPrimary {
290    fn default() -> Self {
291        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
292        unsafe {
293            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
294            s.assume_init()
295        }
296    }
297}
298#[doc = " Secondary device attributes (DA2) response data.\n\n Returned as part of GhosttyDeviceAttributes in response to a CSI > c query.\n Response format: CSI > Pp ; Pv ; Pc c\n\n @ingroup terminal"]
299#[repr(C)]
300#[derive(Debug, Default, Copy, Clone)]
301pub struct GhosttyDeviceAttributesSecondary {
302    #[doc = " Terminal type identifier (Pp). E.g. 1 for VT220."]
303    pub device_type: u16,
304    #[doc = " Firmware/patch version number (Pv)."]
305    pub firmware_version: u16,
306    #[doc = " ROM cartridge registration number (Pc). Always 0 for emulators."]
307    pub rom_cartridge: u16,
308}
309#[allow(clippy::unnecessary_operation, clippy::identity_op)]
310const _: () = {
311    ["Size of GhosttyDeviceAttributesSecondary"]
312        [::std::mem::size_of::<GhosttyDeviceAttributesSecondary>() - 6usize];
313    ["Alignment of GhosttyDeviceAttributesSecondary"]
314        [::std::mem::align_of::<GhosttyDeviceAttributesSecondary>() - 2usize];
315    ["Offset of field: GhosttyDeviceAttributesSecondary::device_type"]
316        [::std::mem::offset_of!(GhosttyDeviceAttributesSecondary, device_type) - 0usize];
317    ["Offset of field: GhosttyDeviceAttributesSecondary::firmware_version"]
318        [::std::mem::offset_of!(GhosttyDeviceAttributesSecondary, firmware_version) - 2usize];
319    ["Offset of field: GhosttyDeviceAttributesSecondary::rom_cartridge"]
320        [::std::mem::offset_of!(GhosttyDeviceAttributesSecondary, rom_cartridge) - 4usize];
321};
322#[doc = " Tertiary device attributes (DA3) response data.\n\n Returned as part of GhosttyDeviceAttributes in response to a CSI = c query.\n Response format: DCS ! | D...D ST (DECRPTUI).\n\n @ingroup terminal"]
323#[repr(C)]
324#[derive(Debug, Default, Copy, Clone)]
325pub struct GhosttyDeviceAttributesTertiary {
326    #[doc = " Unit ID encoded as 8 uppercase hex digits in the response."]
327    pub unit_id: u32,
328}
329#[allow(clippy::unnecessary_operation, clippy::identity_op)]
330const _: () = {
331    ["Size of GhosttyDeviceAttributesTertiary"]
332        [::std::mem::size_of::<GhosttyDeviceAttributesTertiary>() - 4usize];
333    ["Alignment of GhosttyDeviceAttributesTertiary"]
334        [::std::mem::align_of::<GhosttyDeviceAttributesTertiary>() - 4usize];
335    ["Offset of field: GhosttyDeviceAttributesTertiary::unit_id"]
336        [::std::mem::offset_of!(GhosttyDeviceAttributesTertiary, unit_id) - 0usize];
337};
338#[doc = " Device attributes response data for all three DA levels.\n\n Filled by the device_attributes callback in response to CSI c,\n CSI > c, or CSI = c queries. The terminal uses whichever sub-struct\n matches the request type.\n\n @ingroup terminal"]
339#[repr(C)]
340#[derive(Debug, Copy, Clone)]
341pub struct GhosttyDeviceAttributes {
342    pub primary: GhosttyDeviceAttributesPrimary,
343    pub secondary: GhosttyDeviceAttributesSecondary,
344    pub tertiary: GhosttyDeviceAttributesTertiary,
345}
346#[allow(clippy::unnecessary_operation, clippy::identity_op)]
347const _: () = {
348    ["Size of GhosttyDeviceAttributes"]
349        [::std::mem::size_of::<GhosttyDeviceAttributes>() - 160usize];
350    ["Alignment of GhosttyDeviceAttributes"]
351        [::std::mem::align_of::<GhosttyDeviceAttributes>() - 8usize];
352    ["Offset of field: GhosttyDeviceAttributes::primary"]
353        [::std::mem::offset_of!(GhosttyDeviceAttributes, primary) - 0usize];
354    ["Offset of field: GhosttyDeviceAttributes::secondary"]
355        [::std::mem::offset_of!(GhosttyDeviceAttributes, secondary) - 144usize];
356    ["Offset of field: GhosttyDeviceAttributes::tertiary"]
357        [::std::mem::offset_of!(GhosttyDeviceAttributes, tertiary) - 152usize];
358};
359impl Default for GhosttyDeviceAttributes {
360    fn default() -> Self {
361        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
362        unsafe {
363            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
364            s.assume_init()
365        }
366    }
367}
368#[doc = " Terminal window gained focus"]
369pub const GhosttyFocusEvent_GHOSTTY_FOCUS_GAINED: GhosttyFocusEvent = 0;
370#[doc = " Terminal window lost focus"]
371pub const GhosttyFocusEvent_GHOSTTY_FOCUS_LOST: GhosttyFocusEvent = 1;
372#[doc = " Focus event types for focus reporting mode (mode 1004)."]
373pub type GhosttyFocusEvent = ::std::os::raw::c_uint;
374unsafe extern "C" {
375    #[doc = " Encode a focus event into a terminal escape sequence.\n\n Encodes a focus gained (CSI I) or focus lost (CSI O) report into the\n provided buffer.\n\n If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE\n and writes the required buffer size to @p out_written. The caller can\n then retry with a sufficiently sized buffer.\n\n @param event The focus event to encode\n @param buf Output buffer to write the encoded sequence into (may be NULL)\n @param buf_len Size of the output buffer in bytes\n @param[out] out_written On success, the number of bytes written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer\n         is too small"]
376    pub fn ghostty_focus_encode(
377        event: GhosttyFocusEvent,
378        buf: *mut ::std::os::raw::c_char,
379        buf_len: usize,
380        out_written: *mut usize,
381    ) -> GhosttyResult;
382}
383#[doc = " A packed 16-bit terminal mode.\n\n Encodes a mode value (bits 0–14) and an ANSI flag (bit 15) into a\n single 16-bit integer. Use the inline helper functions to construct\n and inspect modes rather than manipulating bits directly."]
384pub type GhosttyMode = u16;
385#[doc = " Mode is not recognized"]
386pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_NOT_RECOGNIZED: GhosttyModeReportState = 0;
387#[doc = " Mode is set (enabled)"]
388pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_SET: GhosttyModeReportState = 1;
389#[doc = " Mode is reset (disabled)"]
390pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_RESET: GhosttyModeReportState = 2;
391#[doc = " Mode is permanently set"]
392pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_PERMANENTLY_SET: GhosttyModeReportState = 3;
393#[doc = " Mode is permanently reset"]
394pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_PERMANENTLY_RESET: GhosttyModeReportState = 4;
395#[doc = " DECRPM report state values.\n\n These correspond to the Ps2 parameter in a DECRPM response\n sequence (CSI ? Ps1 ; Ps2 $ y)."]
396pub type GhosttyModeReportState = ::std::os::raw::c_uint;
397unsafe extern "C" {
398    #[doc = " Encode a DECRPM (DEC Private Mode Report) response sequence.\n\n Writes a mode report escape sequence into the provided buffer.\n The generated sequence has the form:\n - DEC private mode: CSI ? Ps1 ; Ps2 $ y\n - ANSI mode:        CSI Ps1 ; Ps2 $ y\n\n If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE\n and writes the required buffer size to @p out_written. The caller can\n then retry with a sufficiently sized buffer.\n\n @param mode The mode identifying the mode to report on\n @param state The report state for this mode\n @param buf Output buffer to write the encoded sequence into (may be NULL)\n @param buf_len Size of the output buffer in bytes\n @param[out] out_written On success, the number of bytes written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer\n         is too small"]
399    pub fn ghostty_mode_report_encode(
400        mode: GhosttyMode,
401        state: GhosttyModeReportState,
402        buf: *mut ::std::os::raw::c_char,
403        buf_len: usize,
404        out_written: *mut usize,
405    ) -> GhosttyResult;
406}
407#[doc = " In-band size report (mode 2048): ESC [ 48 ; rows ; cols ; height ; width t"]
408pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_MODE_2048: GhosttySizeReportStyle = 0;
409#[doc = " XTWINOPS text area size in pixels: ESC [ 4 ; height ; width t"]
410pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_CSI_14_T: GhosttySizeReportStyle = 1;
411#[doc = " XTWINOPS cell size in pixels: ESC [ 6 ; height ; width t"]
412pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_CSI_16_T: GhosttySizeReportStyle = 2;
413#[doc = " XTWINOPS text area size in characters: ESC [ 8 ; rows ; cols t"]
414pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_CSI_18_T: GhosttySizeReportStyle = 3;
415#[doc = " Size report style.\n\n Determines the output format for the terminal size report."]
416pub type GhosttySizeReportStyle = ::std::os::raw::c_uint;
417#[doc = " Terminal size information for encoding size reports."]
418#[repr(C)]
419#[derive(Debug, Default, Copy, Clone)]
420pub struct GhosttySizeReportSize {
421    #[doc = " Terminal row count in cells."]
422    pub rows: u16,
423    #[doc = " Terminal column count in cells."]
424    pub columns: u16,
425    #[doc = " Width of a single terminal cell in pixels."]
426    pub cell_width: u32,
427    #[doc = " Height of a single terminal cell in pixels."]
428    pub cell_height: u32,
429}
430#[allow(clippy::unnecessary_operation, clippy::identity_op)]
431const _: () = {
432    ["Size of GhosttySizeReportSize"][::std::mem::size_of::<GhosttySizeReportSize>() - 12usize];
433    ["Alignment of GhosttySizeReportSize"]
434        [::std::mem::align_of::<GhosttySizeReportSize>() - 4usize];
435    ["Offset of field: GhosttySizeReportSize::rows"]
436        [::std::mem::offset_of!(GhosttySizeReportSize, rows) - 0usize];
437    ["Offset of field: GhosttySizeReportSize::columns"]
438        [::std::mem::offset_of!(GhosttySizeReportSize, columns) - 2usize];
439    ["Offset of field: GhosttySizeReportSize::cell_width"]
440        [::std::mem::offset_of!(GhosttySizeReportSize, cell_width) - 4usize];
441    ["Offset of field: GhosttySizeReportSize::cell_height"]
442        [::std::mem::offset_of!(GhosttySizeReportSize, cell_height) - 8usize];
443};
444unsafe extern "C" {
445    #[doc = " Encode a terminal size report into an escape sequence.\n\n Encodes a size report in the format specified by @p style into the\n provided buffer.\n\n If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE\n and writes the required buffer size to @p out_written. The caller can\n then retry with a sufficiently sized buffer.\n\n @param style The size report format to encode\n @param size Terminal size information\n @param buf Output buffer to write the encoded sequence into (may be NULL)\n @param buf_len Size of the output buffer in bytes\n @param[out] out_written On success, the number of bytes written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer\n         is too small"]
446    pub fn ghostty_size_report_encode(
447        style: GhosttySizeReportStyle,
448        size: GhosttySizeReportSize,
449        buf: *mut ::std::os::raw::c_char,
450        buf_len: usize,
451        out_written: *mut usize,
452    ) -> GhosttyResult;
453}
454#[doc = " Opaque cell value.\n\n Represents a single terminal cell. The internal layout is opaque and\n must be queried via ghostty_cell_get(). Obtain cell values from\n terminal query APIs.\n\n @ingroup screen"]
455pub type GhosttyCell = u64;
456#[doc = " Opaque row value.\n\n Represents a single terminal row. The internal layout is opaque and\n must be queried via ghostty_row_get(). Obtain row values from\n terminal query APIs.\n\n @ingroup screen"]
457pub type GhosttyRow = u64;
458#[doc = " A single codepoint (may be zero for empty)."]
459pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_CODEPOINT: GhosttyCellContentTag = 0;
460#[doc = " A codepoint that is part of a multi-codepoint grapheme cluster."]
461pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_CODEPOINT_GRAPHEME: GhosttyCellContentTag = 1;
462#[doc = " No text; background color from palette."]
463pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE: GhosttyCellContentTag = 2;
464#[doc = " No text; background color as RGB."]
465pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_BG_COLOR_RGB: GhosttyCellContentTag = 3;
466#[doc = " Cell content tag.\n\n Describes what kind of content a cell holds.\n\n @ingroup screen"]
467pub type GhosttyCellContentTag = ::std::os::raw::c_uint;
468#[doc = " Not a wide character, cell width 1."]
469pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_NARROW: GhosttyCellWide = 0;
470#[doc = " Wide character, cell width 2."]
471pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_WIDE: GhosttyCellWide = 1;
472#[doc = " Spacer after wide character. Do not render."]
473pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_SPACER_TAIL: GhosttyCellWide = 2;
474#[doc = " Spacer at end of soft-wrapped line for a wide character."]
475pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_SPACER_HEAD: GhosttyCellWide = 3;
476#[doc = " Cell wide property.\n\n Describes the width behavior of a cell.\n\n @ingroup screen"]
477pub type GhosttyCellWide = ::std::os::raw::c_uint;
478#[doc = " Regular output content, such as command output."]
479pub const GhosttyCellSemanticContent_GHOSTTY_CELL_SEMANTIC_OUTPUT: GhosttyCellSemanticContent = 0;
480#[doc = " Content that is part of user input."]
481pub const GhosttyCellSemanticContent_GHOSTTY_CELL_SEMANTIC_INPUT: GhosttyCellSemanticContent = 1;
482#[doc = " Content that is part of a shell prompt."]
483pub const GhosttyCellSemanticContent_GHOSTTY_CELL_SEMANTIC_PROMPT: GhosttyCellSemanticContent = 2;
484#[doc = " Semantic content type of a cell.\n\n Set by semantic prompt sequences (OSC 133) to distinguish between\n command output, user input, and shell prompt text.\n\n @ingroup screen"]
485pub type GhosttyCellSemanticContent = ::std::os::raw::c_uint;
486#[doc = " Invalid data type. Never results in any data extraction."]
487pub const GhosttyCellData_GHOSTTY_CELL_DATA_INVALID: GhosttyCellData = 0;
488#[doc = " The codepoint of the cell (0 if empty or bg-color-only).\n\n Output type: uint32_t *"]
489pub const GhosttyCellData_GHOSTTY_CELL_DATA_CODEPOINT: GhosttyCellData = 1;
490#[doc = " The content tag describing what kind of content is in the cell.\n\n Output type: GhosttyCellContentTag *"]
491pub const GhosttyCellData_GHOSTTY_CELL_DATA_CONTENT_TAG: GhosttyCellData = 2;
492#[doc = " The wide property of the cell.\n\n Output type: GhosttyCellWide *"]
493pub const GhosttyCellData_GHOSTTY_CELL_DATA_WIDE: GhosttyCellData = 3;
494#[doc = " Whether the cell has text to render.\n\n Output type: bool *"]
495pub const GhosttyCellData_GHOSTTY_CELL_DATA_HAS_TEXT: GhosttyCellData = 4;
496#[doc = " Whether the cell has non-default styling.\n\n Output type: bool *"]
497pub const GhosttyCellData_GHOSTTY_CELL_DATA_HAS_STYLING: GhosttyCellData = 5;
498#[doc = " The style ID for the cell (for use with style lookups).\n\n Output type: uint16_t *"]
499pub const GhosttyCellData_GHOSTTY_CELL_DATA_STYLE_ID: GhosttyCellData = 6;
500#[doc = " Whether the cell has a hyperlink.\n\n Output type: bool *"]
501pub const GhosttyCellData_GHOSTTY_CELL_DATA_HAS_HYPERLINK: GhosttyCellData = 7;
502#[doc = " Whether the cell is protected.\n\n Output type: bool *"]
503pub const GhosttyCellData_GHOSTTY_CELL_DATA_PROTECTED: GhosttyCellData = 8;
504#[doc = " The semantic content type of the cell (from OSC 133).\n\n Output type: GhosttyCellSemanticContent *"]
505pub const GhosttyCellData_GHOSTTY_CELL_DATA_SEMANTIC_CONTENT: GhosttyCellData = 9;
506#[doc = " The palette index for the cell's background color.\n Only valid when content_tag is GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE.\n\n Output type: GhosttyColorPaletteIndex *"]
507pub const GhosttyCellData_GHOSTTY_CELL_DATA_COLOR_PALETTE: GhosttyCellData = 10;
508#[doc = " The RGB value for the cell's background color.\n Only valid when content_tag is GHOSTTY_CELL_CONTENT_BG_COLOR_RGB.\n\n Output type: GhosttyColorRgb *"]
509pub const GhosttyCellData_GHOSTTY_CELL_DATA_COLOR_RGB: GhosttyCellData = 11;
510#[doc = " Cell data types.\n\n These values specify what type of data to extract from a cell\n using `ghostty_cell_get`.\n\n @ingroup screen"]
511pub type GhosttyCellData = ::std::os::raw::c_uint;
512#[doc = " No prompt cells in this row."]
513pub const GhosttyRowSemanticPrompt_GHOSTTY_ROW_SEMANTIC_NONE: GhosttyRowSemanticPrompt = 0;
514#[doc = " Prompt cells exist and this is a primary prompt line."]
515pub const GhosttyRowSemanticPrompt_GHOSTTY_ROW_SEMANTIC_PROMPT: GhosttyRowSemanticPrompt = 1;
516#[doc = " Prompt cells exist and this is a continuation line."]
517pub const GhosttyRowSemanticPrompt_GHOSTTY_ROW_SEMANTIC_PROMPT_CONTINUATION:
518    GhosttyRowSemanticPrompt = 2;
519#[doc = " Row semantic prompt state.\n\n Indicates whether any cells in a row are part of a shell prompt,\n as reported by OSC 133 sequences.\n\n @ingroup screen"]
520pub type GhosttyRowSemanticPrompt = ::std::os::raw::c_uint;
521#[doc = " Invalid data type. Never results in any data extraction."]
522pub const GhosttyRowData_GHOSTTY_ROW_DATA_INVALID: GhosttyRowData = 0;
523#[doc = " Whether this row is soft-wrapped.\n\n Output type: bool *"]
524pub const GhosttyRowData_GHOSTTY_ROW_DATA_WRAP: GhosttyRowData = 1;
525#[doc = " Whether this row is a continuation of a soft-wrapped row.\n\n Output type: bool *"]
526pub const GhosttyRowData_GHOSTTY_ROW_DATA_WRAP_CONTINUATION: GhosttyRowData = 2;
527#[doc = " Whether any cells in this row have grapheme clusters.\n\n Output type: bool *"]
528pub const GhosttyRowData_GHOSTTY_ROW_DATA_GRAPHEME: GhosttyRowData = 3;
529#[doc = " Whether any cells in this row have styling (may have false positives).\n\n Output type: bool *"]
530pub const GhosttyRowData_GHOSTTY_ROW_DATA_STYLED: GhosttyRowData = 4;
531#[doc = " Whether any cells in this row have hyperlinks (may have false positives).\n\n Output type: bool *"]
532pub const GhosttyRowData_GHOSTTY_ROW_DATA_HYPERLINK: GhosttyRowData = 5;
533#[doc = " The semantic prompt state of this row.\n\n Output type: GhosttyRowSemanticPrompt *"]
534pub const GhosttyRowData_GHOSTTY_ROW_DATA_SEMANTIC_PROMPT: GhosttyRowData = 6;
535#[doc = " Whether this row contains a Kitty virtual placeholder.\n\n Output type: bool *"]
536pub const GhosttyRowData_GHOSTTY_ROW_DATA_KITTY_VIRTUAL_PLACEHOLDER: GhosttyRowData = 7;
537#[doc = " Whether this row is dirty and requires a redraw.\n\n Output type: bool *"]
538pub const GhosttyRowData_GHOSTTY_ROW_DATA_DIRTY: GhosttyRowData = 8;
539#[doc = " Row data types.\n\n These values specify what type of data to extract from a row\n using `ghostty_row_get`.\n\n @ingroup screen"]
540pub type GhosttyRowData = ::std::os::raw::c_uint;
541unsafe extern "C" {
542    #[doc = " Get data from a cell.\n\n Extracts typed data from the given cell based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid data types and output types are documented\n in the `GhosttyCellData` enum.\n\n @param cell The cell value\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the\n         data type is invalid\n\n @ingroup screen"]
543    pub fn ghostty_cell_get(
544        cell: GhosttyCell,
545        data: GhosttyCellData,
546        out: *mut ::std::os::raw::c_void,
547    ) -> GhosttyResult;
548}
549unsafe extern "C" {
550    #[doc = " Get data from a row.\n\n Extracts typed data from the given row based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid data types and output types are documented\n in the `GhosttyRowData` enum.\n\n @param row The row value\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the\n         data type is invalid\n\n @ingroup screen"]
551    pub fn ghostty_row_get(
552        row: GhosttyRow,
553        data: GhosttyRowData,
554        out: *mut ::std::os::raw::c_void,
555    ) -> GhosttyResult;
556}
557#[doc = " Style identifier type.\n\n Used to look up the full style from a grid reference.\n Obtain this from a cell via GHOSTTY_CELL_DATA_STYLE_ID.\n\n @ingroup style"]
558pub type GhosttyStyleId = u16;
559pub const GhosttyStyleColorTag_GHOSTTY_STYLE_COLOR_NONE: GhosttyStyleColorTag = 0;
560pub const GhosttyStyleColorTag_GHOSTTY_STYLE_COLOR_PALETTE: GhosttyStyleColorTag = 1;
561pub const GhosttyStyleColorTag_GHOSTTY_STYLE_COLOR_RGB: GhosttyStyleColorTag = 2;
562#[doc = " Style color tags.\n\n These values identify the type of color in a style color.\n Use the tag to determine which field in the color value union to access.\n\n @ingroup style"]
563pub type GhosttyStyleColorTag = ::std::os::raw::c_uint;
564#[doc = " Style color value union.\n\n Use the tag to determine which field is active.\n\n @ingroup style"]
565#[repr(C)]
566#[derive(Copy, Clone)]
567pub union GhosttyStyleColorValue {
568    pub palette: GhosttyColorPaletteIndex,
569    pub rgb: GhosttyColorRgb,
570    pub _padding: u64,
571}
572#[allow(clippy::unnecessary_operation, clippy::identity_op)]
573const _: () = {
574    ["Size of GhosttyStyleColorValue"][::std::mem::size_of::<GhosttyStyleColorValue>() - 8usize];
575    ["Alignment of GhosttyStyleColorValue"]
576        [::std::mem::align_of::<GhosttyStyleColorValue>() - 8usize];
577    ["Offset of field: GhosttyStyleColorValue::palette"]
578        [::std::mem::offset_of!(GhosttyStyleColorValue, palette) - 0usize];
579    ["Offset of field: GhosttyStyleColorValue::rgb"]
580        [::std::mem::offset_of!(GhosttyStyleColorValue, rgb) - 0usize];
581    ["Offset of field: GhosttyStyleColorValue::_padding"]
582        [::std::mem::offset_of!(GhosttyStyleColorValue, _padding) - 0usize];
583};
584impl Default for GhosttyStyleColorValue {
585    fn default() -> Self {
586        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
587        unsafe {
588            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
589            s.assume_init()
590        }
591    }
592}
593#[doc = " Style color (tagged union).\n\n A color used in a style attribute. Can be unset (none), a palette\n index, or a direct RGB value.\n\n @ingroup style"]
594#[repr(C)]
595#[derive(Copy, Clone)]
596pub struct GhosttyStyleColor {
597    pub tag: GhosttyStyleColorTag,
598    pub value: GhosttyStyleColorValue,
599}
600#[allow(clippy::unnecessary_operation, clippy::identity_op)]
601const _: () = {
602    ["Size of GhosttyStyleColor"][::std::mem::size_of::<GhosttyStyleColor>() - 16usize];
603    ["Alignment of GhosttyStyleColor"][::std::mem::align_of::<GhosttyStyleColor>() - 8usize];
604    ["Offset of field: GhosttyStyleColor::tag"]
605        [::std::mem::offset_of!(GhosttyStyleColor, tag) - 0usize];
606    ["Offset of field: GhosttyStyleColor::value"]
607        [::std::mem::offset_of!(GhosttyStyleColor, value) - 8usize];
608};
609impl Default for GhosttyStyleColor {
610    fn default() -> Self {
611        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
612        unsafe {
613            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
614            s.assume_init()
615        }
616    }
617}
618#[doc = " Terminal cell style.\n\n Describes the complete visual style for a terminal cell, including\n foreground, background, and underline colors, as well as text\n decoration flags. The underline field uses the same values as\n GhosttySgrUnderline.\n\n This is a sized struct. Use GHOSTTY_INIT_SIZED() to initialize it.\n\n @ingroup style"]
619#[repr(C)]
620#[derive(Copy, Clone)]
621pub struct GhosttyStyle {
622    pub size: usize,
623    pub fg_color: GhosttyStyleColor,
624    pub bg_color: GhosttyStyleColor,
625    pub underline_color: GhosttyStyleColor,
626    pub bold: bool,
627    pub italic: bool,
628    pub faint: bool,
629    pub blink: bool,
630    pub inverse: bool,
631    pub invisible: bool,
632    pub strikethrough: bool,
633    pub overline: bool,
634    #[doc = "< One of GHOSTTY_SGR_UNDERLINE_* values"]
635    pub underline: ::std::os::raw::c_int,
636}
637#[allow(clippy::unnecessary_operation, clippy::identity_op)]
638const _: () = {
639    ["Size of GhosttyStyle"][::std::mem::size_of::<GhosttyStyle>() - 72usize];
640    ["Alignment of GhosttyStyle"][::std::mem::align_of::<GhosttyStyle>() - 8usize];
641    ["Offset of field: GhosttyStyle::size"][::std::mem::offset_of!(GhosttyStyle, size) - 0usize];
642    ["Offset of field: GhosttyStyle::fg_color"]
643        [::std::mem::offset_of!(GhosttyStyle, fg_color) - 8usize];
644    ["Offset of field: GhosttyStyle::bg_color"]
645        [::std::mem::offset_of!(GhosttyStyle, bg_color) - 24usize];
646    ["Offset of field: GhosttyStyle::underline_color"]
647        [::std::mem::offset_of!(GhosttyStyle, underline_color) - 40usize];
648    ["Offset of field: GhosttyStyle::bold"][::std::mem::offset_of!(GhosttyStyle, bold) - 56usize];
649    ["Offset of field: GhosttyStyle::italic"]
650        [::std::mem::offset_of!(GhosttyStyle, italic) - 57usize];
651    ["Offset of field: GhosttyStyle::faint"][::std::mem::offset_of!(GhosttyStyle, faint) - 58usize];
652    ["Offset of field: GhosttyStyle::blink"][::std::mem::offset_of!(GhosttyStyle, blink) - 59usize];
653    ["Offset of field: GhosttyStyle::inverse"]
654        [::std::mem::offset_of!(GhosttyStyle, inverse) - 60usize];
655    ["Offset of field: GhosttyStyle::invisible"]
656        [::std::mem::offset_of!(GhosttyStyle, invisible) - 61usize];
657    ["Offset of field: GhosttyStyle::strikethrough"]
658        [::std::mem::offset_of!(GhosttyStyle, strikethrough) - 62usize];
659    ["Offset of field: GhosttyStyle::overline"]
660        [::std::mem::offset_of!(GhosttyStyle, overline) - 63usize];
661    ["Offset of field: GhosttyStyle::underline"]
662        [::std::mem::offset_of!(GhosttyStyle, underline) - 64usize];
663};
664impl Default for GhosttyStyle {
665    fn default() -> Self {
666        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
667        unsafe {
668            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
669            s.assume_init()
670        }
671    }
672}
673unsafe extern "C" {
674    #[doc = " Get the default style.\n\n Initializes the style to the default values (no colors, no flags).\n\n @param style Pointer to the style to initialize\n\n @ingroup style"]
675    pub fn ghostty_style_default(style: *mut GhosttyStyle);
676}
677unsafe extern "C" {
678    #[doc = " Check if a style is the default style.\n\n Returns true if all colors are unset and all flags are off.\n\n @param style Pointer to the style to check\n @return true if the style is the default style\n\n @ingroup style"]
679    pub fn ghostty_style_is_default(style: *const GhosttyStyle) -> bool;
680}
681#[doc = " A resolved reference to a terminal cell position.\n\n This is a sized struct. Use GHOSTTY_INIT_SIZED() to initialize it.\n\n @ingroup grid_ref"]
682#[repr(C)]
683#[derive(Debug, Copy, Clone)]
684pub struct GhosttyGridRef {
685    pub size: usize,
686    pub node: *mut ::std::os::raw::c_void,
687    pub x: u16,
688    pub y: u16,
689}
690#[allow(clippy::unnecessary_operation, clippy::identity_op)]
691const _: () = {
692    ["Size of GhosttyGridRef"][::std::mem::size_of::<GhosttyGridRef>() - 24usize];
693    ["Alignment of GhosttyGridRef"][::std::mem::align_of::<GhosttyGridRef>() - 8usize];
694    ["Offset of field: GhosttyGridRef::size"]
695        [::std::mem::offset_of!(GhosttyGridRef, size) - 0usize];
696    ["Offset of field: GhosttyGridRef::node"]
697        [::std::mem::offset_of!(GhosttyGridRef, node) - 8usize];
698    ["Offset of field: GhosttyGridRef::x"][::std::mem::offset_of!(GhosttyGridRef, x) - 16usize];
699    ["Offset of field: GhosttyGridRef::y"][::std::mem::offset_of!(GhosttyGridRef, y) - 18usize];
700};
701impl Default for GhosttyGridRef {
702    fn default() -> Self {
703        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
704        unsafe {
705            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
706            s.assume_init()
707        }
708    }
709}
710unsafe extern "C" {
711    #[doc = " Get the cell from a grid reference.\n\n @param ref Pointer to the grid reference\n @param[out] out_cell On success, set to the cell at the ref's position (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL\n\n @ingroup grid_ref"]
712    pub fn ghostty_grid_ref_cell(
713        ref_: *const GhosttyGridRef,
714        out_cell: *mut GhosttyCell,
715    ) -> GhosttyResult;
716}
717unsafe extern "C" {
718    #[doc = " Get the row from a grid reference.\n\n @param ref Pointer to the grid reference\n @param[out] out_row On success, set to the row at the ref's position (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL\n\n @ingroup grid_ref"]
719    pub fn ghostty_grid_ref_row(
720        ref_: *const GhosttyGridRef,
721        out_row: *mut GhosttyRow,
722    ) -> GhosttyResult;
723}
724unsafe extern "C" {
725    #[doc = " Get the grapheme cluster codepoints for the cell at the grid reference's\n position.\n\n Writes the full grapheme cluster (the cell's primary codepoint followed by\n any combining codepoints) into the provided buffer. If the cell has no text,\n out_len is set to 0 and GHOSTTY_SUCCESS is returned.\n\n If the buffer is too small (or NULL), the function returns\n GHOSTTY_OUT_OF_SPACE and writes the required number of codepoints to\n out_len. The caller can then retry with a sufficiently sized buffer.\n\n @param ref Pointer to the grid reference\n @param buf Output buffer of uint32_t codepoints (may be NULL)\n @param buf_len Number of uint32_t elements in the buffer\n @param[out] out_len On success, the number of codepoints written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size in codepoints.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL, GHOSTTY_OUT_OF_SPACE if the buffer is too small\n\n @ingroup grid_ref"]
726    pub fn ghostty_grid_ref_graphemes(
727        ref_: *const GhosttyGridRef,
728        buf: *mut u32,
729        buf_len: usize,
730        out_len: *mut usize,
731    ) -> GhosttyResult;
732}
733unsafe extern "C" {
734    #[doc = " Get the style of the cell at the grid reference's position.\n\n @param ref Pointer to the grid reference\n @param[out] out_style On success, set to the cell's style (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL\n\n @ingroup grid_ref"]
735    pub fn ghostty_grid_ref_style(
736        ref_: *const GhosttyGridRef,
737        out_style: *mut GhosttyStyle,
738    ) -> GhosttyResult;
739}
740#[doc = " A coordinate in the terminal grid.\n\n @ingroup point"]
741#[repr(C)]
742#[derive(Debug, Default, Copy, Clone)]
743pub struct GhosttyPointCoordinate {
744    #[doc = " Column (0-indexed)."]
745    pub x: u16,
746    #[doc = " Row (0-indexed). May exceed page size for screen/history tags."]
747    pub y: u32,
748}
749#[allow(clippy::unnecessary_operation, clippy::identity_op)]
750const _: () = {
751    ["Size of GhosttyPointCoordinate"][::std::mem::size_of::<GhosttyPointCoordinate>() - 8usize];
752    ["Alignment of GhosttyPointCoordinate"]
753        [::std::mem::align_of::<GhosttyPointCoordinate>() - 4usize];
754    ["Offset of field: GhosttyPointCoordinate::x"]
755        [::std::mem::offset_of!(GhosttyPointCoordinate, x) - 0usize];
756    ["Offset of field: GhosttyPointCoordinate::y"]
757        [::std::mem::offset_of!(GhosttyPointCoordinate, y) - 4usize];
758};
759#[doc = " Active area where the cursor can move."]
760pub const GhosttyPointTag_GHOSTTY_POINT_TAG_ACTIVE: GhosttyPointTag = 0;
761#[doc = " Visible viewport (changes when scrolled)."]
762pub const GhosttyPointTag_GHOSTTY_POINT_TAG_VIEWPORT: GhosttyPointTag = 1;
763#[doc = " Full screen including scrollback."]
764pub const GhosttyPointTag_GHOSTTY_POINT_TAG_SCREEN: GhosttyPointTag = 2;
765#[doc = " Scrollback history only (before active area)."]
766pub const GhosttyPointTag_GHOSTTY_POINT_TAG_HISTORY: GhosttyPointTag = 3;
767#[doc = " Point reference tag.\n\n Determines which coordinate system a point uses.\n\n @ingroup point"]
768pub type GhosttyPointTag = ::std::os::raw::c_uint;
769#[doc = " Point value union.\n\n @ingroup point"]
770#[repr(C)]
771#[derive(Copy, Clone)]
772pub union GhosttyPointValue {
773    #[doc = " Coordinate (used for all tag variants)."]
774    pub coordinate: GhosttyPointCoordinate,
775    #[doc = " Padding for ABI compatibility. Do not use."]
776    pub _padding: [u64; 2usize],
777}
778#[allow(clippy::unnecessary_operation, clippy::identity_op)]
779const _: () = {
780    ["Size of GhosttyPointValue"][::std::mem::size_of::<GhosttyPointValue>() - 16usize];
781    ["Alignment of GhosttyPointValue"][::std::mem::align_of::<GhosttyPointValue>() - 8usize];
782    ["Offset of field: GhosttyPointValue::coordinate"]
783        [::std::mem::offset_of!(GhosttyPointValue, coordinate) - 0usize];
784    ["Offset of field: GhosttyPointValue::_padding"]
785        [::std::mem::offset_of!(GhosttyPointValue, _padding) - 0usize];
786};
787impl Default for GhosttyPointValue {
788    fn default() -> Self {
789        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
790        unsafe {
791            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
792            s.assume_init()
793        }
794    }
795}
796#[doc = " Tagged union for a point in the terminal grid.\n\n @ingroup point"]
797#[repr(C)]
798#[derive(Copy, Clone)]
799pub struct GhosttyPoint {
800    pub tag: GhosttyPointTag,
801    pub value: GhosttyPointValue,
802}
803#[allow(clippy::unnecessary_operation, clippy::identity_op)]
804const _: () = {
805    ["Size of GhosttyPoint"][::std::mem::size_of::<GhosttyPoint>() - 24usize];
806    ["Alignment of GhosttyPoint"][::std::mem::align_of::<GhosttyPoint>() - 8usize];
807    ["Offset of field: GhosttyPoint::tag"][::std::mem::offset_of!(GhosttyPoint, tag) - 0usize];
808    ["Offset of field: GhosttyPoint::value"][::std::mem::offset_of!(GhosttyPoint, value) - 8usize];
809};
810impl Default for GhosttyPoint {
811    fn default() -> Self {
812        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
813        unsafe {
814            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
815            s.assume_init()
816        }
817    }
818}
819#[repr(C)]
820#[derive(Debug, Copy, Clone)]
821pub struct GhosttyTerminal {
822    _unused: [u8; 0],
823}
824#[doc = " Opaque handle to a terminal instance.\n\n @ingroup terminal"]
825pub type GhosttyTerminal_ptr = *mut GhosttyTerminal;
826#[doc = " Terminal initialization options.\n\n @ingroup terminal"]
827#[repr(C)]
828#[derive(Debug, Default, Copy, Clone)]
829pub struct GhosttyTerminalOptions {
830    #[doc = " Terminal width in cells. Must be greater than zero."]
831    pub cols: u16,
832    #[doc = " Terminal height in cells. Must be greater than zero."]
833    pub rows: u16,
834    #[doc = " Maximum number of lines to keep in scrollback history."]
835    pub max_scrollback: usize,
836}
837#[allow(clippy::unnecessary_operation, clippy::identity_op)]
838const _: () = {
839    ["Size of GhosttyTerminalOptions"][::std::mem::size_of::<GhosttyTerminalOptions>() - 16usize];
840    ["Alignment of GhosttyTerminalOptions"]
841        [::std::mem::align_of::<GhosttyTerminalOptions>() - 8usize];
842    ["Offset of field: GhosttyTerminalOptions::cols"]
843        [::std::mem::offset_of!(GhosttyTerminalOptions, cols) - 0usize];
844    ["Offset of field: GhosttyTerminalOptions::rows"]
845        [::std::mem::offset_of!(GhosttyTerminalOptions, rows) - 2usize];
846    ["Offset of field: GhosttyTerminalOptions::max_scrollback"]
847        [::std::mem::offset_of!(GhosttyTerminalOptions, max_scrollback) - 8usize];
848};
849#[doc = " Scroll to the top of the scrollback."]
850pub const GhosttyTerminalScrollViewportTag_GHOSTTY_SCROLL_VIEWPORT_TOP:
851    GhosttyTerminalScrollViewportTag = 0;
852#[doc = " Scroll to the bottom (active area)."]
853pub const GhosttyTerminalScrollViewportTag_GHOSTTY_SCROLL_VIEWPORT_BOTTOM:
854    GhosttyTerminalScrollViewportTag = 1;
855#[doc = " Scroll by a delta amount (up is negative)."]
856pub const GhosttyTerminalScrollViewportTag_GHOSTTY_SCROLL_VIEWPORT_DELTA:
857    GhosttyTerminalScrollViewportTag = 2;
858#[doc = " Scroll viewport behavior tag.\n\n @ingroup terminal"]
859pub type GhosttyTerminalScrollViewportTag = ::std::os::raw::c_uint;
860#[doc = " Scroll viewport value.\n\n @ingroup terminal"]
861#[repr(C)]
862#[derive(Copy, Clone)]
863pub union GhosttyTerminalScrollViewportValue {
864    #[doc = " Scroll delta (only used with GHOSTTY_SCROLL_VIEWPORT_DELTA). Up is negative."]
865    pub delta: isize,
866    #[doc = " Padding for ABI compatibility. Do not use."]
867    pub _padding: [u64; 2usize],
868}
869#[allow(clippy::unnecessary_operation, clippy::identity_op)]
870const _: () = {
871    ["Size of GhosttyTerminalScrollViewportValue"]
872        [::std::mem::size_of::<GhosttyTerminalScrollViewportValue>() - 16usize];
873    ["Alignment of GhosttyTerminalScrollViewportValue"]
874        [::std::mem::align_of::<GhosttyTerminalScrollViewportValue>() - 8usize];
875    ["Offset of field: GhosttyTerminalScrollViewportValue::delta"]
876        [::std::mem::offset_of!(GhosttyTerminalScrollViewportValue, delta) - 0usize];
877    ["Offset of field: GhosttyTerminalScrollViewportValue::_padding"]
878        [::std::mem::offset_of!(GhosttyTerminalScrollViewportValue, _padding) - 0usize];
879};
880impl Default for GhosttyTerminalScrollViewportValue {
881    fn default() -> Self {
882        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
883        unsafe {
884            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
885            s.assume_init()
886        }
887    }
888}
889#[doc = " Tagged union for scroll viewport behavior.\n\n @ingroup terminal"]
890#[repr(C)]
891#[derive(Copy, Clone)]
892pub struct GhosttyTerminalScrollViewport {
893    pub tag: GhosttyTerminalScrollViewportTag,
894    pub value: GhosttyTerminalScrollViewportValue,
895}
896#[allow(clippy::unnecessary_operation, clippy::identity_op)]
897const _: () = {
898    ["Size of GhosttyTerminalScrollViewport"]
899        [::std::mem::size_of::<GhosttyTerminalScrollViewport>() - 24usize];
900    ["Alignment of GhosttyTerminalScrollViewport"]
901        [::std::mem::align_of::<GhosttyTerminalScrollViewport>() - 8usize];
902    ["Offset of field: GhosttyTerminalScrollViewport::tag"]
903        [::std::mem::offset_of!(GhosttyTerminalScrollViewport, tag) - 0usize];
904    ["Offset of field: GhosttyTerminalScrollViewport::value"]
905        [::std::mem::offset_of!(GhosttyTerminalScrollViewport, value) - 8usize];
906};
907impl Default for GhosttyTerminalScrollViewport {
908    fn default() -> Self {
909        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
910        unsafe {
911            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
912            s.assume_init()
913        }
914    }
915}
916#[doc = " The primary (normal) screen."]
917pub const GhosttyTerminalScreen_GHOSTTY_TERMINAL_SCREEN_PRIMARY: GhosttyTerminalScreen = 0;
918#[doc = " The alternate screen."]
919pub const GhosttyTerminalScreen_GHOSTTY_TERMINAL_SCREEN_ALTERNATE: GhosttyTerminalScreen = 1;
920#[doc = " Terminal screen identifier.\n\n Identifies which screen buffer is active in the terminal.\n\n @ingroup terminal"]
921pub type GhosttyTerminalScreen = ::std::os::raw::c_uint;
922#[doc = " Scrollbar state for the terminal viewport.\n\n Represents the scrollable area dimensions needed to render a scrollbar.\n\n @ingroup terminal"]
923#[repr(C)]
924#[derive(Debug, Default, Copy, Clone)]
925pub struct GhosttyTerminalScrollbar {
926    #[doc = " Total size of the scrollable area in rows."]
927    pub total: u64,
928    #[doc = " Offset into the total area that the viewport is at."]
929    pub offset: u64,
930    #[doc = " Length of the visible area in rows."]
931    pub len: u64,
932}
933#[allow(clippy::unnecessary_operation, clippy::identity_op)]
934const _: () = {
935    ["Size of GhosttyTerminalScrollbar"]
936        [::std::mem::size_of::<GhosttyTerminalScrollbar>() - 24usize];
937    ["Alignment of GhosttyTerminalScrollbar"]
938        [::std::mem::align_of::<GhosttyTerminalScrollbar>() - 8usize];
939    ["Offset of field: GhosttyTerminalScrollbar::total"]
940        [::std::mem::offset_of!(GhosttyTerminalScrollbar, total) - 0usize];
941    ["Offset of field: GhosttyTerminalScrollbar::offset"]
942        [::std::mem::offset_of!(GhosttyTerminalScrollbar, offset) - 8usize];
943    ["Offset of field: GhosttyTerminalScrollbar::len"]
944        [::std::mem::offset_of!(GhosttyTerminalScrollbar, len) - 16usize];
945};
946#[doc = " Callback function type for bell.\n\n Called when the terminal receives a BEL character (0x07).\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n\n @ingroup terminal"]
947pub type GhosttyTerminalBellFn = ::std::option::Option<
948    unsafe extern "C" fn(terminal: GhosttyTerminal_ptr, userdata: *mut ::std::os::raw::c_void),
949>;
950#[doc = " Callback function type for color scheme queries (CSI ? 996 n).\n\n Called when the terminal receives a color scheme device status report\n query. Return true and fill *out_scheme with the current color scheme,\n or return false to silently ignore the query.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param[out] out_scheme Pointer to store the current color scheme\n @return true if the color scheme was filled, false to ignore the query\n\n @ingroup terminal"]
951pub type GhosttyTerminalColorSchemeFn = ::std::option::Option<
952    unsafe extern "C" fn(
953        terminal: GhosttyTerminal_ptr,
954        userdata: *mut ::std::os::raw::c_void,
955        out_scheme: *mut GhosttyColorScheme,
956    ) -> bool,
957>;
958#[doc = " Callback function type for device attributes queries (DA1/DA2/DA3).\n\n Called when the terminal receives a device attributes query (CSI c,\n CSI > c, or CSI = c). Return true and fill *out_attrs with the\n response data, or return false to silently ignore the query.\n\n The terminal uses whichever sub-struct (primary, secondary, tertiary)\n matches the request type, but all three should be filled for simplicity.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param[out] out_attrs Pointer to store the device attributes response\n @return true if attributes were filled, false to ignore the query\n\n @ingroup terminal"]
959pub type GhosttyTerminalDeviceAttributesFn = ::std::option::Option<
960    unsafe extern "C" fn(
961        terminal: GhosttyTerminal_ptr,
962        userdata: *mut ::std::os::raw::c_void,
963        out_attrs: *mut GhosttyDeviceAttributes,
964    ) -> bool,
965>;
966#[doc = " Callback function type for enquiry (ENQ, 0x05).\n\n Called when the terminal receives an ENQ character. Return the\n response bytes as a GhosttyString. The memory must remain valid\n until the callback returns. Return a zero-length string to send\n no response.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @return The response bytes to write back to the pty\n\n @ingroup terminal"]
967pub type GhosttyTerminalEnquiryFn = ::std::option::Option<
968    unsafe extern "C" fn(
969        terminal: GhosttyTerminal_ptr,
970        userdata: *mut ::std::os::raw::c_void,
971    ) -> GhosttyString,
972>;
973#[doc = " Callback function type for size queries (XTWINOPS).\n\n Called in response to XTWINOPS size queries (CSI 14/16/18 t).\n Return true and fill *out_size with the current terminal geometry,\n or return false to silently ignore the query.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param[out] out_size Pointer to store the terminal size information\n @return true if size was filled, false to ignore the query\n\n @ingroup terminal"]
974pub type GhosttyTerminalSizeFn = ::std::option::Option<
975    unsafe extern "C" fn(
976        terminal: GhosttyTerminal_ptr,
977        userdata: *mut ::std::os::raw::c_void,
978        out_size: *mut GhosttySizeReportSize,
979    ) -> bool,
980>;
981#[doc = " Callback function type for title_changed.\n\n Called when the terminal title changes via escape sequences\n (e.g. OSC 0 or OSC 2). The new title can be queried from the\n terminal after the callback returns.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n\n @ingroup terminal"]
982pub type GhosttyTerminalTitleChangedFn = ::std::option::Option<
983    unsafe extern "C" fn(terminal: GhosttyTerminal_ptr, userdata: *mut ::std::os::raw::c_void),
984>;
985#[doc = " Callback function type for write_pty.\n\n Called when the terminal needs to write data back to the pty, for\n example in response to a device status report or mode query. The\n data is only valid for the duration of the call; callers must copy\n it if it needs to persist.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param data Pointer to the response bytes\n @param len Length of the response in bytes\n\n @ingroup terminal"]
986pub type GhosttyTerminalWritePtyFn = ::std::option::Option<
987    unsafe extern "C" fn(
988        terminal: GhosttyTerminal_ptr,
989        userdata: *mut ::std::os::raw::c_void,
990        data: *const u8,
991        len: usize,
992    ),
993>;
994#[doc = " Callback function type for XTVERSION.\n\n Called when the terminal receives an XTVERSION query (CSI > q).\n Return the version string (e.g. \"myterm 1.0\") as a GhosttyString.\n The memory must remain valid until the callback returns. Return a\n zero-length string to report the default \"libghostty\" version.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @return The version string to report\n\n @ingroup terminal"]
995pub type GhosttyTerminalXtversionFn = ::std::option::Option<
996    unsafe extern "C" fn(
997        terminal: GhosttyTerminal_ptr,
998        userdata: *mut ::std::os::raw::c_void,
999    ) -> GhosttyString,
1000>;
1001#[doc = " Opaque userdata pointer passed to all callbacks.\n\n Input type: void*"]
1002pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_USERDATA: GhosttyTerminalOption = 0;
1003#[doc = " Callback invoked when the terminal needs to write data back\n to the pty (e.g. in response to a DECRQM query or device\n status report). Set to NULL to ignore such sequences.\n\n Input type: GhosttyTerminalWritePtyFn"]
1004pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_WRITE_PTY: GhosttyTerminalOption = 1;
1005#[doc = " Callback invoked when the terminal receives a BEL character\n (0x07). Set to NULL to ignore bell events.\n\n Input type: GhosttyTerminalBellFn"]
1006pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_BELL: GhosttyTerminalOption = 2;
1007#[doc = " Callback invoked when the terminal receives an ENQ character\n (0x05). Set to NULL to send no response.\n\n Input type: GhosttyTerminalEnquiryFn"]
1008pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_ENQUIRY: GhosttyTerminalOption = 3;
1009#[doc = " Callback invoked when the terminal receives an XTVERSION query\n (CSI > q). Set to NULL to report the default \"libghostty\" string.\n\n Input type: GhosttyTerminalXtversionFn"]
1010pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_XTVERSION: GhosttyTerminalOption = 4;
1011#[doc = " Callback invoked when the terminal title changes via escape\n sequences (e.g. OSC 0 or OSC 2). Set to NULL to ignore title\n change events.\n\n Input type: GhosttyTerminalTitleChangedFn"]
1012pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_TITLE_CHANGED: GhosttyTerminalOption = 5;
1013#[doc = " Callback invoked in response to XTWINOPS size queries\n (CSI 14/16/18 t). Set to NULL to silently ignore size queries.\n\n Input type: GhosttyTerminalSizeFn"]
1014pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_SIZE: GhosttyTerminalOption = 6;
1015#[doc = " Callback invoked in response to a color scheme device status\n report query (CSI ? 996 n). Return true and fill the out pointer\n to report the current scheme, or return false to silently ignore.\n Set to NULL to ignore color scheme queries.\n\n Input type: GhosttyTerminalColorSchemeFn"]
1016pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_COLOR_SCHEME: GhosttyTerminalOption = 7;
1017#[doc = " Callback invoked in response to a device attributes query\n (CSI c, CSI > c, or CSI = c). Return true and fill the out\n pointer with response data, or return false to silently ignore.\n Set to NULL to ignore device attributes queries.\n\n Input type: GhosttyTerminalDeviceAttributesFn"]
1018pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES: GhosttyTerminalOption = 8;
1019#[doc = " Set the terminal title manually.\n\n The string data is copied into the terminal. A NULL value pointer\n clears the title (equivalent to setting an empty string).\n\n Input type: GhosttyString*"]
1020pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_TITLE: GhosttyTerminalOption = 9;
1021#[doc = " Set the terminal working directory manually.\n\n The string data is copied into the terminal. A NULL value pointer\n clears the pwd (equivalent to setting an empty string).\n\n Input type: GhosttyString*"]
1022pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_PWD: GhosttyTerminalOption = 10;
1023#[doc = " Terminal option identifiers.\n\n These values are used with ghostty_terminal_set() to configure\n terminal callbacks and associated state.\n\n @ingroup terminal"]
1024pub type GhosttyTerminalOption = ::std::os::raw::c_uint;
1025#[doc = " Invalid data type. Never results in any data extraction."]
1026pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_INVALID: GhosttyTerminalData = 0;
1027#[doc = " Terminal width in cells.\n\n Output type: uint16_t *"]
1028pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_COLS: GhosttyTerminalData = 1;
1029#[doc = " Terminal height in cells.\n\n Output type: uint16_t *"]
1030pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_ROWS: GhosttyTerminalData = 2;
1031#[doc = " Cursor column position (0-indexed).\n\n Output type: uint16_t *"]
1032pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_X: GhosttyTerminalData = 3;
1033#[doc = " Cursor row position within the active area (0-indexed).\n\n Output type: uint16_t *"]
1034pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_Y: GhosttyTerminalData = 4;
1035#[doc = " Whether the cursor has a pending wrap (next print will soft-wrap).\n\n Output type: bool *"]
1036pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_PENDING_WRAP: GhosttyTerminalData = 5;
1037#[doc = " The currently active screen.\n\n Output type: GhosttyTerminalScreen *"]
1038pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_ACTIVE_SCREEN: GhosttyTerminalData = 6;
1039#[doc = " Whether the cursor is visible (DEC mode 25).\n\n Output type: bool *"]
1040pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_VISIBLE: GhosttyTerminalData = 7;
1041#[doc = " Current Kitty keyboard protocol flags.\n\n Output type: GhosttyKittyKeyFlags * (uint8_t *)"]
1042pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_KITTY_KEYBOARD_FLAGS: GhosttyTerminalData = 8;
1043#[doc = " Scrollbar state for the terminal viewport.\n\n This may be expensive to calculate depending on where the viewport\n is (arbitrary pins are expensive). The caller should take care to only\n call this as needed and not too frequently.\n\n Output type: GhosttyTerminalScrollbar *"]
1044pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_SCROLLBAR: GhosttyTerminalData = 9;
1045#[doc = " The current SGR style of the cursor.\n\n This is the style that will be applied to newly printed characters.\n\n Output type: GhosttyStyle *"]
1046pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_STYLE: GhosttyTerminalData = 10;
1047#[doc = " Whether any mouse tracking mode is active.\n\n Returns true if any of the mouse tracking modes (X10, normal, button,\n or any-event) are enabled.\n\n Output type: bool *"]
1048pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_MOUSE_TRACKING: GhosttyTerminalData = 11;
1049#[doc = " The terminal title as set by escape sequences (e.g. OSC 0/2).\n\n Returns a borrowed string. The pointer is valid until the next call\n to ghostty_terminal_vt_write() or ghostty_terminal_reset(). An empty\n string (len=0) is returned when no title has been set.\n\n Output type: GhosttyString *"]
1050pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_TITLE: GhosttyTerminalData = 12;
1051#[doc = " The terminal's current working directory as set by escape sequences\n (e.g. OSC 7).\n\n Returns a borrowed string. The pointer is valid until the next call\n to ghostty_terminal_vt_write() or ghostty_terminal_reset(). An empty\n string (len=0) is returned when no pwd has been set.\n\n Output type: GhosttyString *"]
1052pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_PWD: GhosttyTerminalData = 13;
1053#[doc = " The total number of rows in the active screen including scrollback.\n\n Output type: size_t *"]
1054pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_TOTAL_ROWS: GhosttyTerminalData = 14;
1055#[doc = " The number of scrollback rows (total rows minus viewport rows).\n\n Output type: size_t *"]
1056pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_SCROLLBACK_ROWS: GhosttyTerminalData = 15;
1057#[doc = " The total width of the terminal in pixels.\n\n This is cols * cell_width_px as set by ghostty_terminal_resize().\n\n Output type: uint32_t *"]
1058pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_WIDTH_PX: GhosttyTerminalData = 16;
1059#[doc = " The total height of the terminal in pixels.\n\n This is rows * cell_height_px as set by ghostty_terminal_resize().\n\n Output type: uint32_t *"]
1060pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_HEIGHT_PX: GhosttyTerminalData = 17;
1061#[doc = " Terminal data types.\n\n These values specify what type of data to extract from a terminal\n using `ghostty_terminal_get`.\n\n @ingroup terminal"]
1062pub type GhosttyTerminalData = ::std::os::raw::c_uint;
1063unsafe extern "C" {
1064    #[doc = " Create a new terminal instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param terminal Pointer to store the created terminal handle\n @param options Terminal initialization options\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup terminal"]
1065    pub fn ghostty_terminal_new(
1066        allocator: *const GhosttyAllocator,
1067        terminal: *mut GhosttyTerminal_ptr,
1068        options: GhosttyTerminalOptions,
1069    ) -> GhosttyResult;
1070}
1071unsafe extern "C" {
1072    #[doc = " Free a terminal instance.\n\n Releases all resources associated with the terminal. After this call,\n the terminal handle becomes invalid and must not be used.\n\n @param terminal The terminal handle to free (may be NULL)\n\n @ingroup terminal"]
1073    pub fn ghostty_terminal_free(terminal: GhosttyTerminal_ptr);
1074}
1075unsafe extern "C" {
1076    #[doc = " Perform a full reset of the terminal (RIS).\n\n Resets all terminal state back to its initial configuration, including\n modes, scrollback, scrolling region, and screen contents. The terminal\n dimensions are preserved.\n\n @param terminal The terminal handle (may be NULL, in which case this is a no-op)\n\n @ingroup terminal"]
1077    pub fn ghostty_terminal_reset(terminal: GhosttyTerminal_ptr);
1078}
1079unsafe extern "C" {
1080    #[doc = " Resize the terminal to the given dimensions.\n\n Changes the number of columns and rows in the terminal. The primary\n screen will reflow content if wraparound mode is enabled; the alternate\n screen does not reflow. If the dimensions are unchanged, this is a no-op.\n\n This also updates the terminal's pixel dimensions (used for image\n protocols and size reports), disables synchronized output mode (allowed\n by the spec so that resize results are shown immediately), and sends an\n in-band size report if mode 2048 is enabled.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param cols New width in cells (must be greater than zero)\n @param rows New height in cells (must be greater than zero)\n @param cell_width_px Width of a single cell in pixels\n @param cell_height_px Height of a single cell in pixels\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup terminal"]
1081    pub fn ghostty_terminal_resize(
1082        terminal: GhosttyTerminal_ptr,
1083        cols: u16,
1084        rows: u16,
1085        cell_width_px: u32,
1086        cell_height_px: u32,
1087    ) -> GhosttyResult;
1088}
1089unsafe extern "C" {
1090    #[doc = " Set an option on the terminal.\n\n Configures terminal callbacks and associated state such as the\n write_pty callback and userdata pointer. The value is passed\n directly for pointer types (callbacks, userdata) or as a pointer\n to the value for non-pointer types (e.g. GhosttyString*).\n NULL clears the option to its default.\n\n Callbacks are invoked synchronously during ghostty_terminal_vt_write().\n Callbacks must not call ghostty_terminal_vt_write() on the same\n terminal (no reentrancy).\n\n @param terminal The terminal handle (may be NULL, in which case this is a no-op)\n @param option The option to set\n @param value Pointer to the value to set (type depends on the option),\n              or NULL to clear the option\n\n @ingroup terminal"]
1091    pub fn ghostty_terminal_set(
1092        terminal: GhosttyTerminal_ptr,
1093        option: GhosttyTerminalOption,
1094        value: *const ::std::os::raw::c_void,
1095    ) -> GhosttyResult;
1096}
1097unsafe extern "C" {
1098    #[doc = " Write VT-encoded data to the terminal for processing.\n\n Feeds raw bytes through the terminal's VT stream parser, updating\n terminal state accordingly. By default, sequences that require output\n (queries, device status reports) are silently ignored. Use\n ghostty_terminal_set() with GHOSTTY_TERMINAL_OPT_WRITE_PTY to install\n a callback that receives response data.\n\n This never fails. Any erroneous input or errors in processing the\n input are logged internally but do not cause this function to fail\n because this input is assumed to be untrusted and from an external\n source; so the primary goal is to keep the terminal state consistent and\n not allow malformed input to corrupt or crash.\n\n @param terminal The terminal handle\n @param data Pointer to the data to write\n @param len Length of the data in bytes\n\n @ingroup terminal"]
1099    pub fn ghostty_terminal_vt_write(terminal: GhosttyTerminal_ptr, data: *const u8, len: usize);
1100}
1101unsafe extern "C" {
1102    #[doc = " Scroll the terminal viewport.\n\n Scrolls the terminal's viewport according to the given behavior.\n When using GHOSTTY_SCROLL_VIEWPORT_DELTA, set the delta field in\n the value union to specify the number of rows to scroll (negative\n for up, positive for down). For other behaviors, the value is ignored.\n\n @param terminal The terminal handle (may be NULL, in which case this is a no-op)\n @param behavior The scroll behavior as a tagged union\n\n @ingroup terminal"]
1103    pub fn ghostty_terminal_scroll_viewport(
1104        terminal: GhosttyTerminal_ptr,
1105        behavior: GhosttyTerminalScrollViewport,
1106    );
1107}
1108unsafe extern "C" {
1109    #[doc = " Get the current value of a terminal mode.\n\n Returns the value of the mode identified by the given mode.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param mode The mode identifying the mode to query\n @param[out] out_value On success, set to true if the mode is set, false\n             if it is reset\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the mode does not correspond to a known mode\n\n @ingroup terminal"]
1110    pub fn ghostty_terminal_mode_get(
1111        terminal: GhosttyTerminal_ptr,
1112        mode: GhosttyMode,
1113        out_value: *mut bool,
1114    ) -> GhosttyResult;
1115}
1116unsafe extern "C" {
1117    #[doc = " Set the value of a terminal mode.\n\n Sets the mode identified by the given mode to the specified value.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param mode The mode identifying the mode to set\n @param value true to set the mode, false to reset it\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the mode does not correspond to a known mode\n\n @ingroup terminal"]
1118    pub fn ghostty_terminal_mode_set(
1119        terminal: GhosttyTerminal_ptr,
1120        mode: GhosttyMode,
1121        value: bool,
1122    ) -> GhosttyResult;
1123}
1124unsafe extern "C" {
1125    #[doc = " Get data from a terminal instance.\n\n Extracts typed data from the given terminal based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid data types and output types are documented\n in the `GhosttyTerminalData` enum.\n\n @param terminal The terminal handle (may be NULL)\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the data type is invalid\n\n @ingroup terminal"]
1126    pub fn ghostty_terminal_get(
1127        terminal: GhosttyTerminal_ptr,
1128        data: GhosttyTerminalData,
1129        out: *mut ::std::os::raw::c_void,
1130    ) -> GhosttyResult;
1131}
1132unsafe extern "C" {
1133    #[doc = " Resolve a point in the terminal grid to a grid reference.\n\n Resolves the given point (which can be in active, viewport, screen,\n or history coordinates) to a grid reference for that location. Use\n ghostty_grid_ref_cell() and ghostty_grid_ref_row() to extract the cell\n and row.\n\n Lookups using the `active` and `viewport` tags are fast. The `screen`\n and `history` tags may require traversing the full scrollback page list\n to resolve the y coordinate, so they can be expensive for large\n scrollback buffers.\n\n This function isn't meant to be used as the core of render loop. It\n isn't built to sustain the framerates needed for rendering large screens.\n Use the render state API for that. This API is instead meant for less\n strictly performance-sensitive use cases.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param point The point specifying which cell to look up\n @param[out] out_ref On success, set to the grid reference at the given point (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the point is out of bounds\n\n @ingroup terminal"]
1134    pub fn ghostty_terminal_grid_ref(
1135        terminal: GhosttyTerminal_ptr,
1136        point: GhosttyPoint,
1137        out_ref: *mut GhosttyGridRef,
1138    ) -> GhosttyResult;
1139}
1140#[doc = " Plain text (no escape sequences)."]
1141pub const GhosttyFormatterFormat_GHOSTTY_FORMATTER_FORMAT_PLAIN: GhosttyFormatterFormat = 0;
1142#[doc = " VT sequences preserving colors, styles, URLs, etc."]
1143pub const GhosttyFormatterFormat_GHOSTTY_FORMATTER_FORMAT_VT: GhosttyFormatterFormat = 1;
1144#[doc = " HTML with inline styles."]
1145pub const GhosttyFormatterFormat_GHOSTTY_FORMATTER_FORMAT_HTML: GhosttyFormatterFormat = 2;
1146#[doc = " Output format.\n\n @ingroup formatter"]
1147pub type GhosttyFormatterFormat = ::std::os::raw::c_uint;
1148#[doc = " Extra screen state to include in styled output.\n\n @ingroup formatter"]
1149#[repr(C)]
1150#[derive(Debug, Default, Copy, Clone)]
1151pub struct GhosttyFormatterScreenExtra {
1152    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyFormatterScreenExtra)."]
1153    pub size: usize,
1154    #[doc = " Emit cursor position using CUP (CSI H)."]
1155    pub cursor: bool,
1156    #[doc = " Emit current SGR style state based on the cursor's active style_id."]
1157    pub style: bool,
1158    #[doc = " Emit current hyperlink state using OSC 8 sequences."]
1159    pub hyperlink: bool,
1160    #[doc = " Emit character protection mode using DECSCA."]
1161    pub protection: bool,
1162    #[doc = " Emit Kitty keyboard protocol state using CSI > u and CSI = sequences."]
1163    pub kitty_keyboard: bool,
1164    #[doc = " Emit character set designations and invocations."]
1165    pub charsets: bool,
1166}
1167#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1168const _: () = {
1169    ["Size of GhosttyFormatterScreenExtra"]
1170        [::std::mem::size_of::<GhosttyFormatterScreenExtra>() - 16usize];
1171    ["Alignment of GhosttyFormatterScreenExtra"]
1172        [::std::mem::align_of::<GhosttyFormatterScreenExtra>() - 8usize];
1173    ["Offset of field: GhosttyFormatterScreenExtra::size"]
1174        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, size) - 0usize];
1175    ["Offset of field: GhosttyFormatterScreenExtra::cursor"]
1176        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, cursor) - 8usize];
1177    ["Offset of field: GhosttyFormatterScreenExtra::style"]
1178        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, style) - 9usize];
1179    ["Offset of field: GhosttyFormatterScreenExtra::hyperlink"]
1180        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, hyperlink) - 10usize];
1181    ["Offset of field: GhosttyFormatterScreenExtra::protection"]
1182        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, protection) - 11usize];
1183    ["Offset of field: GhosttyFormatterScreenExtra::kitty_keyboard"]
1184        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, kitty_keyboard) - 12usize];
1185    ["Offset of field: GhosttyFormatterScreenExtra::charsets"]
1186        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, charsets) - 13usize];
1187};
1188#[doc = " Extra terminal state to include in styled output.\n\n @ingroup formatter"]
1189#[repr(C)]
1190#[derive(Debug, Default, Copy, Clone)]
1191pub struct GhosttyFormatterTerminalExtra {
1192    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyFormatterTerminalExtra)."]
1193    pub size: usize,
1194    #[doc = " Emit the palette using OSC 4 sequences."]
1195    pub palette: bool,
1196    #[doc = " Emit terminal modes that differ from their defaults using CSI h/l."]
1197    pub modes: bool,
1198    #[doc = " Emit scrolling region state using DECSTBM and DECSLRM sequences."]
1199    pub scrolling_region: bool,
1200    #[doc = " Emit tabstop positions by clearing all tabs and setting each one."]
1201    pub tabstops: bool,
1202    #[doc = " Emit the present working directory using OSC 7."]
1203    pub pwd: bool,
1204    #[doc = " Emit keyboard modes such as ModifyOtherKeys."]
1205    pub keyboard: bool,
1206    #[doc = " Screen-level extras."]
1207    pub screen: GhosttyFormatterScreenExtra,
1208}
1209#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1210const _: () = {
1211    ["Size of GhosttyFormatterTerminalExtra"]
1212        [::std::mem::size_of::<GhosttyFormatterTerminalExtra>() - 32usize];
1213    ["Alignment of GhosttyFormatterTerminalExtra"]
1214        [::std::mem::align_of::<GhosttyFormatterTerminalExtra>() - 8usize];
1215    ["Offset of field: GhosttyFormatterTerminalExtra::size"]
1216        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, size) - 0usize];
1217    ["Offset of field: GhosttyFormatterTerminalExtra::palette"]
1218        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, palette) - 8usize];
1219    ["Offset of field: GhosttyFormatterTerminalExtra::modes"]
1220        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, modes) - 9usize];
1221    ["Offset of field: GhosttyFormatterTerminalExtra::scrolling_region"]
1222        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, scrolling_region) - 10usize];
1223    ["Offset of field: GhosttyFormatterTerminalExtra::tabstops"]
1224        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, tabstops) - 11usize];
1225    ["Offset of field: GhosttyFormatterTerminalExtra::pwd"]
1226        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, pwd) - 12usize];
1227    ["Offset of field: GhosttyFormatterTerminalExtra::keyboard"]
1228        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, keyboard) - 13usize];
1229    ["Offset of field: GhosttyFormatterTerminalExtra::screen"]
1230        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, screen) - 16usize];
1231};
1232#[repr(C)]
1233#[derive(Debug, Copy, Clone)]
1234pub struct GhosttyFormatter {
1235    _unused: [u8; 0],
1236}
1237#[doc = " Opaque handle to a formatter instance.\n\n @ingroup formatter"]
1238pub type GhosttyFormatter_ptr = *mut GhosttyFormatter;
1239#[doc = " Options for creating a terminal formatter.\n\n @ingroup formatter"]
1240#[repr(C)]
1241#[derive(Debug, Copy, Clone)]
1242pub struct GhosttyFormatterTerminalOptions {
1243    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyFormatterTerminalOptions)."]
1244    pub size: usize,
1245    #[doc = " Output format to emit."]
1246    pub emit: GhosttyFormatterFormat,
1247    #[doc = " Whether to unwrap soft-wrapped lines."]
1248    pub unwrap: bool,
1249    #[doc = " Whether to trim trailing whitespace on non-blank lines."]
1250    pub trim: bool,
1251    #[doc = " Extra terminal state to include in styled output."]
1252    pub extra: GhosttyFormatterTerminalExtra,
1253}
1254#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1255const _: () = {
1256    ["Size of GhosttyFormatterTerminalOptions"]
1257        [::std::mem::size_of::<GhosttyFormatterTerminalOptions>() - 48usize];
1258    ["Alignment of GhosttyFormatterTerminalOptions"]
1259        [::std::mem::align_of::<GhosttyFormatterTerminalOptions>() - 8usize];
1260    ["Offset of field: GhosttyFormatterTerminalOptions::size"]
1261        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, size) - 0usize];
1262    ["Offset of field: GhosttyFormatterTerminalOptions::emit"]
1263        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, emit) - 8usize];
1264    ["Offset of field: GhosttyFormatterTerminalOptions::unwrap"]
1265        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, unwrap) - 12usize];
1266    ["Offset of field: GhosttyFormatterTerminalOptions::trim"]
1267        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, trim) - 13usize];
1268    ["Offset of field: GhosttyFormatterTerminalOptions::extra"]
1269        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, extra) - 16usize];
1270};
1271impl Default for GhosttyFormatterTerminalOptions {
1272    fn default() -> Self {
1273        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1274        unsafe {
1275            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1276            s.assume_init()
1277        }
1278    }
1279}
1280unsafe extern "C" {
1281    #[doc = " Create a formatter for a terminal's active screen.\n\n The terminal must outlive the formatter. The formatter stores a borrowed\n reference to the terminal and reads its current state on each format call.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param formatter Pointer to store the created formatter handle\n @param terminal The terminal to format (must not be NULL)\n @param options Formatting options\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup formatter"]
1282    pub fn ghostty_formatter_terminal_new(
1283        allocator: *const GhosttyAllocator,
1284        formatter: *mut GhosttyFormatter_ptr,
1285        terminal: GhosttyTerminal_ptr,
1286        options: GhosttyFormatterTerminalOptions,
1287    ) -> GhosttyResult;
1288}
1289unsafe extern "C" {
1290    #[doc = " Run the formatter and produce output into the caller-provided buffer.\n\n Each call formats the current terminal state. Pass NULL for buf to\n query the required buffer size without writing any output; in that case\n out_written receives the required size and the return value is\n GHOSTTY_OUT_OF_SPACE.\n\n If the buffer is too small, returns GHOSTTY_OUT_OF_SPACE and sets\n out_written to the required size. The caller can then retry with a\n larger buffer.\n\n @param formatter The formatter handle (must not be NULL)\n @param buf Pointer to the output buffer, or NULL to query size\n @param buf_len Length of the output buffer in bytes\n @param out_written Pointer to receive the number of bytes written,\n                    or the required size on failure\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup formatter"]
1291    pub fn ghostty_formatter_format_buf(
1292        formatter: GhosttyFormatter_ptr,
1293        buf: *mut u8,
1294        buf_len: usize,
1295        out_written: *mut usize,
1296    ) -> GhosttyResult;
1297}
1298unsafe extern "C" {
1299    #[doc = " Run the formatter and return an allocated buffer with the output.\n\n Each call formats the current terminal state. The buffer is allocated\n using the provided allocator (or the default allocator if NULL).\n The caller is responsible for freeing the returned buffer with\n ghostty_free(), passing the same allocator (or NULL for the default)\n that was used for the allocation.\n\n @param formatter The formatter handle (must not be NULL)\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param out_ptr Pointer to receive the allocated buffer\n @param out_len Pointer to receive the length of the output in bytes\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n         failure\n\n @ingroup formatter"]
1300    pub fn ghostty_formatter_format_alloc(
1301        formatter: GhosttyFormatter_ptr,
1302        allocator: *const GhosttyAllocator,
1303        out_ptr: *mut *mut u8,
1304        out_len: *mut usize,
1305    ) -> GhosttyResult;
1306}
1307unsafe extern "C" {
1308    #[doc = " Free a formatter instance.\n\n Releases all resources associated with the formatter. After this call,\n the formatter handle becomes invalid.\n\n @param formatter The formatter handle to free (may be NULL)\n\n @ingroup formatter"]
1309    pub fn ghostty_formatter_free(formatter: GhosttyFormatter_ptr);
1310}
1311#[repr(C)]
1312#[derive(Debug, Copy, Clone)]
1313pub struct GhosttyRenderState {
1314    _unused: [u8; 0],
1315}
1316#[doc = " Opaque handle to a render state instance.\n\n @ingroup render"]
1317pub type GhosttyRenderState_ptr = *mut GhosttyRenderState;
1318#[repr(C)]
1319#[derive(Debug, Copy, Clone)]
1320pub struct GhosttyRenderStateRowIterator {
1321    _unused: [u8; 0],
1322}
1323#[doc = " Opaque handle to a render-state row iterator.\n\n @ingroup render"]
1324pub type GhosttyRenderStateRowIterator_ptr = *mut GhosttyRenderStateRowIterator;
1325#[repr(C)]
1326#[derive(Debug, Copy, Clone)]
1327pub struct GhosttyRenderStateRowCells {
1328    _unused: [u8; 0],
1329}
1330#[doc = " Opaque handle to render-state row cells.\n\n @ingroup render"]
1331pub type GhosttyRenderStateRowCells_ptr = *mut GhosttyRenderStateRowCells;
1332#[doc = " Not dirty at all; rendering can be skipped."]
1333pub const GhosttyRenderStateDirty_GHOSTTY_RENDER_STATE_DIRTY_FALSE: GhosttyRenderStateDirty = 0;
1334#[doc = " Some rows changed; renderer can redraw incrementally."]
1335pub const GhosttyRenderStateDirty_GHOSTTY_RENDER_STATE_DIRTY_PARTIAL: GhosttyRenderStateDirty = 1;
1336#[doc = " Global state changed; renderer should redraw everything."]
1337pub const GhosttyRenderStateDirty_GHOSTTY_RENDER_STATE_DIRTY_FULL: GhosttyRenderStateDirty = 2;
1338#[doc = " Dirty state of a render state after update.\n\n @ingroup render"]
1339pub type GhosttyRenderStateDirty = ::std::os::raw::c_uint;
1340#[doc = " Bar cursor (DECSCUSR 5, 6)."]
1341pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BAR:
1342    GhosttyRenderStateCursorVisualStyle = 0;
1343#[doc = " Block cursor (DECSCUSR 1, 2)."]
1344pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BLOCK:
1345    GhosttyRenderStateCursorVisualStyle = 1;
1346#[doc = " Underline cursor (DECSCUSR 3, 4)."]
1347pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_UNDERLINE:
1348    GhosttyRenderStateCursorVisualStyle = 2;
1349#[doc = " Hollow block cursor."]
1350pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BLOCK_HOLLOW : GhosttyRenderStateCursorVisualStyle = 3 ;
1351#[doc = " Visual style of the cursor.\n\n @ingroup render"]
1352pub type GhosttyRenderStateCursorVisualStyle = ::std::os::raw::c_uint;
1353#[doc = " Invalid / sentinel value."]
1354pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_INVALID: GhosttyRenderStateData = 0;
1355#[doc = " Viewport width in cells (uint16_t)."]
1356pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLS: GhosttyRenderStateData = 1;
1357#[doc = " Viewport height in cells (uint16_t)."]
1358pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_ROWS: GhosttyRenderStateData = 2;
1359#[doc = " Current dirty state (GhosttyRenderStateDirty)."]
1360pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_DIRTY: GhosttyRenderStateData = 3;
1361#[doc = " Populate a pre-allocated GhosttyRenderStateRowIterator with row data\n  from the render state (GhosttyRenderStateRowIterator). Row data is\n  only valid as long as the underlying render state is not updated.\n  It is unsafe to use row data after updating the render state."]
1362pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR: GhosttyRenderStateData = 4;
1363#[doc = " Default/current background color (GhosttyColorRgb)."]
1364pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_BACKGROUND:
1365    GhosttyRenderStateData = 5;
1366#[doc = " Default/current foreground color (GhosttyColorRgb)."]
1367pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_FOREGROUND:
1368    GhosttyRenderStateData = 6;
1369#[doc = " Cursor color when explicitly set by terminal state (GhosttyColorRgb).\n  Returns GHOSTTY_INVALID_VALUE if no explicit cursor color is set;\n  use COLOR_CURSOR_HAS_VALUE to check first."]
1370pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR: GhosttyRenderStateData = 7;
1371#[doc = " Whether an explicit cursor color is set (bool)."]
1372pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR_HAS_VALUE:
1373    GhosttyRenderStateData = 8;
1374#[doc = " The active 256-color palette (GhosttyColorRgb[256])."]
1375pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_PALETTE: GhosttyRenderStateData =
1376    9;
1377#[doc = " The visual style of the cursor (GhosttyRenderStateCursorVisualStyle)."]
1378pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VISUAL_STYLE:
1379    GhosttyRenderStateData = 10;
1380#[doc = " Whether the cursor is visible based on terminal modes (bool)."]
1381pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VISIBLE: GhosttyRenderStateData =
1382    11;
1383#[doc = " Whether the cursor should blink based on terminal modes (bool)."]
1384pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_BLINKING: GhosttyRenderStateData =
1385    12;
1386#[doc = " Whether the cursor is at a password input field (bool)."]
1387pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_PASSWORD_INPUT:
1388    GhosttyRenderStateData = 13;
1389#[doc = " Whether the cursor is visible within the viewport (bool).\n  If false, the cursor viewport position values are undefined."]
1390pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_HAS_VALUE:
1391    GhosttyRenderStateData = 14;
1392#[doc = " Cursor viewport x position in cells (uint16_t).\n  Only valid when CURSOR_VIEWPORT_HAS_VALUE is true."]
1393pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_X:
1394    GhosttyRenderStateData = 15;
1395#[doc = " Cursor viewport y position in cells (uint16_t).\n  Only valid when CURSOR_VIEWPORT_HAS_VALUE is true."]
1396pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_Y:
1397    GhosttyRenderStateData = 16;
1398#[doc = " Whether the cursor is on the tail of a wide character (bool).\n  Only valid when CURSOR_VIEWPORT_HAS_VALUE is true."]
1399pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_WIDE_TAIL:
1400    GhosttyRenderStateData = 17;
1401#[doc = " Queryable data kinds for ghostty_render_state_get().\n\n @ingroup render"]
1402pub type GhosttyRenderStateData = ::std::os::raw::c_uint;
1403#[doc = " Set dirty state (GhosttyRenderStateDirty)."]
1404pub const GhosttyRenderStateOption_GHOSTTY_RENDER_STATE_OPTION_DIRTY: GhosttyRenderStateOption = 0;
1405#[doc = " Settable options for ghostty_render_state_set().\n\n @ingroup render"]
1406pub type GhosttyRenderStateOption = ::std::os::raw::c_uint;
1407#[doc = " Invalid / sentinel value."]
1408pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_INVALID:
1409    GhosttyRenderStateRowData = 0;
1410#[doc = " Whether the current row is dirty (bool)."]
1411pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_DIRTY: GhosttyRenderStateRowData =
1412    1;
1413#[doc = " The raw row value (GhosttyRow)."]
1414pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_RAW: GhosttyRenderStateRowData =
1415    2;
1416#[doc = " Populate a pre-allocated GhosttyRenderStateRowCells with cell data for\n  the current row (GhosttyRenderStateRowCells). Cell data is only\n  valid as long as the underlying render state is not updated.\n  It is unsafe to use cell data after updating the render state."]
1417pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_CELLS: GhosttyRenderStateRowData =
1418    3;
1419#[doc = " Queryable data kinds for ghostty_render_state_row_get().\n\n @ingroup render"]
1420pub type GhosttyRenderStateRowData = ::std::os::raw::c_uint;
1421#[doc = " Set dirty state for the current row (bool)."]
1422pub const GhosttyRenderStateRowOption_GHOSTTY_RENDER_STATE_ROW_OPTION_DIRTY:
1423    GhosttyRenderStateRowOption = 0;
1424#[doc = " Settable options for ghostty_render_state_row_set().\n\n @ingroup render"]
1425pub type GhosttyRenderStateRowOption = ::std::os::raw::c_uint;
1426#[doc = " Render-state color information.\n\n This struct uses the sized-struct ABI pattern. Initialize with\n GHOSTTY_INIT_SIZED(GhosttyRenderStateColors) before calling\n ghostty_render_state_colors_get().\n\n Example:\n @code\n GhosttyRenderStateColors colors = GHOSTTY_INIT_SIZED(GhosttyRenderStateColors);\n GhosttyResult result = ghostty_render_state_colors_get(state, &colors);\n @endcode\n\n @ingroup render"]
1427#[repr(C)]
1428#[derive(Debug, Copy, Clone)]
1429pub struct GhosttyRenderStateColors {
1430    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyRenderStateColors)."]
1431    pub size: usize,
1432    #[doc = " The default/current background color for the render state."]
1433    pub background: GhosttyColorRgb,
1434    #[doc = " The default/current foreground color for the render state."]
1435    pub foreground: GhosttyColorRgb,
1436    #[doc = " The cursor color when explicitly set by terminal state."]
1437    pub cursor: GhosttyColorRgb,
1438    #[doc = " True when cursor contains a valid explicit cursor color value.\n If this is false, the cursor color should be ignored; it will\n contain undefined data."]
1439    pub cursor_has_value: bool,
1440    #[doc = " The active 256-color palette for this render state."]
1441    pub palette: [GhosttyColorRgb; 256usize],
1442}
1443#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1444const _: () = {
1445    ["Size of GhosttyRenderStateColors"]
1446        [::std::mem::size_of::<GhosttyRenderStateColors>() - 792usize];
1447    ["Alignment of GhosttyRenderStateColors"]
1448        [::std::mem::align_of::<GhosttyRenderStateColors>() - 8usize];
1449    ["Offset of field: GhosttyRenderStateColors::size"]
1450        [::std::mem::offset_of!(GhosttyRenderStateColors, size) - 0usize];
1451    ["Offset of field: GhosttyRenderStateColors::background"]
1452        [::std::mem::offset_of!(GhosttyRenderStateColors, background) - 8usize];
1453    ["Offset of field: GhosttyRenderStateColors::foreground"]
1454        [::std::mem::offset_of!(GhosttyRenderStateColors, foreground) - 11usize];
1455    ["Offset of field: GhosttyRenderStateColors::cursor"]
1456        [::std::mem::offset_of!(GhosttyRenderStateColors, cursor) - 14usize];
1457    ["Offset of field: GhosttyRenderStateColors::cursor_has_value"]
1458        [::std::mem::offset_of!(GhosttyRenderStateColors, cursor_has_value) - 17usize];
1459    ["Offset of field: GhosttyRenderStateColors::palette"]
1460        [::std::mem::offset_of!(GhosttyRenderStateColors, palette) - 18usize];
1461};
1462impl Default for GhosttyRenderStateColors {
1463    fn default() -> Self {
1464        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1465        unsafe {
1466            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1467            s.assume_init()
1468        }
1469    }
1470}
1471unsafe extern "C" {
1472    #[doc = " Create a new render state instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param state Pointer to store the created render state handle\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n failure\n\n @ingroup render"]
1473    pub fn ghostty_render_state_new(
1474        allocator: *const GhosttyAllocator,
1475        state: *mut GhosttyRenderState_ptr,
1476    ) -> GhosttyResult;
1477}
1478unsafe extern "C" {
1479    #[doc = " Free a render state instance.\n\n Releases all resources associated with the render state. After this call,\n the render state handle becomes invalid.\n\n @param state The render state handle to free (may be NULL)\n\n @ingroup render"]
1480    pub fn ghostty_render_state_free(state: GhosttyRenderState_ptr);
1481}
1482unsafe extern "C" {
1483    #[doc = " Update a render state instance from a terminal.\n\n This consumes terminal/screen dirty state in the same way as the internal\n render state update path.\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param terminal The terminal handle to read from (NULL returns GHOSTTY_INVALID_VALUE)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` or\n `terminal` is NULL, GHOSTTY_OUT_OF_MEMORY if updating the state requires\n allocation and that allocation fails\n\n @ingroup render"]
1484    pub fn ghostty_render_state_update(
1485        state: GhosttyRenderState_ptr,
1486        terminal: GhosttyTerminal_ptr,
1487    ) -> GhosttyResult;
1488}
1489unsafe extern "C" {
1490    #[doc = " Get a value from a render state.\n\n The `out` pointer must point to a value of the type corresponding to the\n requested data kind (see GhosttyRenderStateData).\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param data The data kind to query\n @param[out] out Pointer to receive the queried value\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` is\n         NULL or `data` is not a recognized enum value\n\n @ingroup render"]
1491    pub fn ghostty_render_state_get(
1492        state: GhosttyRenderState_ptr,
1493        data: GhosttyRenderStateData,
1494        out: *mut ::std::os::raw::c_void,
1495    ) -> GhosttyResult;
1496}
1497unsafe extern "C" {
1498    #[doc = " Set an option on a render state.\n\n The `value` pointer must point to a value of the type corresponding to the\n requested option kind (see GhosttyRenderStateOption).\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param option The option to set\n @param[in] value Pointer to the value to set (NULL returns\n            GHOSTTY_INVALID_VALUE)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` or\n         `value` is NULL\n\n @ingroup render"]
1499    pub fn ghostty_render_state_set(
1500        state: GhosttyRenderState_ptr,
1501        option: GhosttyRenderStateOption,
1502        value: *const ::std::os::raw::c_void,
1503    ) -> GhosttyResult;
1504}
1505unsafe extern "C" {
1506    #[doc = " Get the current color information from a render state.\n\n This writes as many fields as fit in the caller-provided sized struct.\n `out_colors->size` must be set by the caller (typically via\n GHOSTTY_INIT_SIZED(GhosttyRenderStateColors)).\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param[out] out_colors Sized output struct to receive render-state colors\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` or\n         `out_colors` is NULL, or if `out_colors->size` is smaller than\n         `sizeof(size_t)`\n\n @ingroup render"]
1507    pub fn ghostty_render_state_colors_get(
1508        state: GhosttyRenderState_ptr,
1509        out_colors: *mut GhosttyRenderStateColors,
1510    ) -> GhosttyResult;
1511}
1512unsafe extern "C" {
1513    #[doc = " Create a new row iterator instance.\n\n All fields except the allocator are left undefined until populated\n via ghostty_render_state_get() with\n GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param[out] out_iterator On success, receives the created iterator handle\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n         failure\n\n @ingroup render"]
1514    pub fn ghostty_render_state_row_iterator_new(
1515        allocator: *const GhosttyAllocator,
1516        out_iterator: *mut GhosttyRenderStateRowIterator_ptr,
1517    ) -> GhosttyResult;
1518}
1519unsafe extern "C" {
1520    #[doc = " Free a render-state row iterator.\n\n @param iterator The iterator handle to free (may be NULL)\n\n @ingroup render"]
1521    pub fn ghostty_render_state_row_iterator_free(iterator: GhosttyRenderStateRowIterator_ptr);
1522}
1523unsafe extern "C" {
1524    #[doc = " Move a render-state row iterator to the next row.\n\n Returns true if the iterator moved successfully and row data is\n available to read at the new position.\n\n @param iterator The iterator handle to advance (may be NULL)\n @return true if advanced to the next row, false if `iterator` is\n         NULL or if the iterator has reached the end\n\n @ingroup render"]
1525    pub fn ghostty_render_state_row_iterator_next(
1526        iterator: GhosttyRenderStateRowIterator_ptr,
1527    ) -> bool;
1528}
1529unsafe extern "C" {
1530    #[doc = " Get a value from the current row in a render-state row iterator.\n\n The `out` pointer must point to a value of the type corresponding to the\n requested data kind (see GhosttyRenderStateRowData).\n Call ghostty_render_state_row_iterator_next() at least once before\n calling this function.\n\n @param iterator The iterator handle to query (NULL returns GHOSTTY_INVALID_VALUE)\n @param data The data kind to query\n @param[out] out Pointer to receive the queried value\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if\n         `iterator` is NULL or the iterator is not positioned on a row\n\n @ingroup render"]
1531    pub fn ghostty_render_state_row_get(
1532        iterator: GhosttyRenderStateRowIterator_ptr,
1533        data: GhosttyRenderStateRowData,
1534        out: *mut ::std::os::raw::c_void,
1535    ) -> GhosttyResult;
1536}
1537unsafe extern "C" {
1538    #[doc = " Set an option on the current row in a render-state row iterator.\n\n The `value` pointer must point to a value of the type corresponding to the\n requested option kind (see GhosttyRenderStateRowOption).\n Call ghostty_render_state_row_iterator_next() at least once before\n calling this function.\n\n @param iterator The iterator handle to update (NULL returns GHOSTTY_INVALID_VALUE)\n @param option The option to set\n @param[in] value Pointer to the value to set (NULL returns\n            GHOSTTY_INVALID_VALUE)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if\n         `iterator` is NULL or the iterator is not positioned on a row\n\n @ingroup render"]
1539    pub fn ghostty_render_state_row_set(
1540        iterator: GhosttyRenderStateRowIterator_ptr,
1541        option: GhosttyRenderStateRowOption,
1542        value: *const ::std::os::raw::c_void,
1543    ) -> GhosttyResult;
1544}
1545unsafe extern "C" {
1546    #[doc = " Create a new row cells instance.\n\n All fields except the allocator are left undefined until populated\n via ghostty_render_state_row_get() with\n GHOSTTY_RENDER_STATE_ROW_DATA_CELLS.\n\n You can reuse this value repeatedly with ghostty_render_state_row_get() to\n avoid allocating a new cells container for every row.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param[out] out_cells On success, receives the created row cells handle\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n         failure\n\n @ingroup render"]
1547    pub fn ghostty_render_state_row_cells_new(
1548        allocator: *const GhosttyAllocator,
1549        out_cells: *mut GhosttyRenderStateRowCells_ptr,
1550    ) -> GhosttyResult;
1551}
1552#[doc = " Invalid / sentinel value."]
1553pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_INVALID:
1554    GhosttyRenderStateRowCellsData = 0;
1555#[doc = " The raw cell value (GhosttyCell)."]
1556pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_RAW:
1557    GhosttyRenderStateRowCellsData = 1;
1558#[doc = " The style for the current cell (GhosttyStyle)."]
1559pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_STYLE:
1560    GhosttyRenderStateRowCellsData = 2;
1561#[doc = " The total number of grapheme codepoints including the base codepoint\n  (uint32_t). Returns 0 if the cell has no text."]
1562pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_LEN:
1563    GhosttyRenderStateRowCellsData = 3;
1564#[doc = " Write grapheme codepoints into a caller-provided buffer (uint32_t*).\n  The buffer must be at least graphemes_len elements. The base codepoint\n  is written first, followed by any extra codepoints."]
1565pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_BUF:
1566    GhosttyRenderStateRowCellsData = 4;
1567#[doc = " The resolved background color of the cell (GhosttyColorRgb).\n  Flattens the three possible sources: content-tag bg_color_rgb,\n  content-tag bg_color_palette (looked up in the palette), or the\n  style's bg_color. Returns GHOSTTY_INVALID_VALUE if the cell has\n  no background color, in which case the caller should use whatever\n  default background color it wants (e.g. the terminal background)."]
1568pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_BG_COLOR:
1569    GhosttyRenderStateRowCellsData = 5;
1570#[doc = " The resolved foreground color of the cell (GhosttyColorRgb).\n  Resolves palette indices through the palette. Bold color handling\n  is not applied; the caller should handle bold styling separately.\n  Returns GHOSTTY_INVALID_VALUE if the cell has no explicit foreground\n  color, in which case the caller should use whatever default foreground\n  color it wants (e.g. the terminal foreground)."]
1571pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_FG_COLOR:
1572    GhosttyRenderStateRowCellsData = 6;
1573#[doc = " Queryable data kinds for ghostty_render_state_row_cells_get().\n\n @ingroup render"]
1574pub type GhosttyRenderStateRowCellsData = ::std::os::raw::c_uint;
1575unsafe extern "C" {
1576    #[doc = " Move a render-state row cells iterator to the next cell.\n\n Returns true if the iterator moved successfully and cell data is\n available to read at the new position.\n\n @param cells The row cells handle to advance (may be NULL)\n @return true if advanced to the next cell, false if `cells` is\n         NULL or if the iterator has reached the end\n\n @ingroup render"]
1577    pub fn ghostty_render_state_row_cells_next(cells: GhosttyRenderStateRowCells_ptr) -> bool;
1578}
1579unsafe extern "C" {
1580    #[doc = " Move a render-state row cells iterator to a specific column.\n\n Positions the iterator at the given x (column) index so that\n subsequent reads return data for that cell.\n\n @param cells The row cells handle to reposition (NULL returns\n        GHOSTTY_INVALID_VALUE)\n @param x The zero-based column index to select\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `cells`\n         is NULL or `x` is out of range\n\n @ingroup render"]
1581    pub fn ghostty_render_state_row_cells_select(
1582        cells: GhosttyRenderStateRowCells_ptr,
1583        x: u16,
1584    ) -> GhosttyResult;
1585}
1586unsafe extern "C" {
1587    #[doc = " Get a value from the current cell in a render-state row cells iterator.\n\n The `out` pointer must point to a value of the type corresponding to the\n requested data kind (see GhosttyRenderStateRowCellsData).\n Call ghostty_render_state_row_cells_next() or\n ghostty_render_state_row_cells_select() at least once before\n calling this function.\n\n @param cells The row cells handle to query (NULL returns GHOSTTY_INVALID_VALUE)\n @param data The data kind to query\n @param[out] out Pointer to receive the queried value\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if\n         `cells` is NULL or the iterator is not positioned on a cell\n\n @ingroup render"]
1588    pub fn ghostty_render_state_row_cells_get(
1589        cells: GhosttyRenderStateRowCells_ptr,
1590        data: GhosttyRenderStateRowCellsData,
1591        out: *mut ::std::os::raw::c_void,
1592    ) -> GhosttyResult;
1593}
1594unsafe extern "C" {
1595    #[doc = " Free a row cells instance.\n\n @param cells The row cells handle to free (may be NULL)\n\n @ingroup render"]
1596    pub fn ghostty_render_state_row_cells_free(cells: GhosttyRenderStateRowCells_ptr);
1597}
1598#[repr(C)]
1599#[derive(Debug, Copy, Clone)]
1600pub struct GhosttyOscParser {
1601    _unused: [u8; 0],
1602}
1603#[doc = " Opaque handle to an OSC parser instance.\n\n This handle represents an OSC (Operating System Command) parser that can\n be used to parse the contents of OSC sequences.\n\n @ingroup osc"]
1604pub type GhosttyOscParser_ptr = *mut GhosttyOscParser;
1605#[repr(C)]
1606#[derive(Debug, Copy, Clone)]
1607pub struct GhosttyOscCommand {
1608    _unused: [u8; 0],
1609}
1610#[doc = " Opaque handle to a single OSC command.\n\n This handle represents a parsed OSC (Operating System Command) command.\n The command can be queried for its type and associated data.\n\n @ingroup osc"]
1611pub type GhosttyOscCommand_ptr = *mut GhosttyOscCommand;
1612pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_INVALID: GhosttyOscCommandType = 0;
1613pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE: GhosttyOscCommandType = 1;
1614pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_ICON: GhosttyOscCommandType = 2;
1615pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_SEMANTIC_PROMPT: GhosttyOscCommandType = 3;
1616pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CLIPBOARD_CONTENTS: GhosttyOscCommandType = 4;
1617pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_REPORT_PWD: GhosttyOscCommandType = 5;
1618pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_MOUSE_SHAPE: GhosttyOscCommandType = 6;
1619pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_COLOR_OPERATION: GhosttyOscCommandType = 7;
1620pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_KITTY_COLOR_PROTOCOL: GhosttyOscCommandType = 8;
1621pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_SHOW_DESKTOP_NOTIFICATION:
1622    GhosttyOscCommandType = 9;
1623pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_HYPERLINK_START: GhosttyOscCommandType = 10;
1624pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_HYPERLINK_END: GhosttyOscCommandType = 11;
1625pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_SLEEP: GhosttyOscCommandType = 12;
1626pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_SHOW_MESSAGE_BOX: GhosttyOscCommandType =
1627    13;
1628pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_CHANGE_TAB_TITLE: GhosttyOscCommandType =
1629    14;
1630pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_PROGRESS_REPORT: GhosttyOscCommandType =
1631    15;
1632pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_WAIT_INPUT: GhosttyOscCommandType = 16;
1633pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_GUIMACRO: GhosttyOscCommandType = 17;
1634pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_RUN_PROCESS: GhosttyOscCommandType = 18;
1635pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_OUTPUT_ENVIRONMENT_VARIABLE:
1636    GhosttyOscCommandType = 19;
1637pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_XTERM_EMULATION: GhosttyOscCommandType =
1638    20;
1639pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_COMMENT: GhosttyOscCommandType = 21;
1640pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_KITTY_TEXT_SIZING: GhosttyOscCommandType = 22;
1641#[doc = " OSC command types.\n\n @ingroup osc"]
1642pub type GhosttyOscCommandType = ::std::os::raw::c_uint;
1643#[doc = " Invalid data type. Never results in any data extraction."]
1644pub const GhosttyOscCommandData_GHOSTTY_OSC_DATA_INVALID: GhosttyOscCommandData = 0;
1645#[doc = " Window title string data.\n\n Valid for: GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE\n\n Output type: const char ** (pointer to null-terminated string)\n\n Lifetime: Valid until the next call to any ghostty_osc_* function with\n the same parser instance. Memory is owned by the parser."]
1646pub const GhosttyOscCommandData_GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR: GhosttyOscCommandData = 1;
1647#[doc = " OSC command data types.\n\n These values specify what type of data to extract from an OSC command\n using `ghostty_osc_command_data`.\n\n @ingroup osc"]
1648pub type GhosttyOscCommandData = ::std::os::raw::c_uint;
1649unsafe extern "C" {
1650    #[doc = " Create a new OSC parser instance.\n\n Creates a new OSC (Operating System Command) parser using the provided\n allocator. The parser must be freed using ghostty_vt_osc_free() when\n no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator\n @param parser Pointer to store the created parser handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup osc"]
1651    pub fn ghostty_osc_new(
1652        allocator: *const GhosttyAllocator,
1653        parser: *mut GhosttyOscParser_ptr,
1654    ) -> GhosttyResult;
1655}
1656unsafe extern "C" {
1657    #[doc = " Free an OSC parser instance.\n\n Releases all resources associated with the OSC parser. After this call,\n the parser handle becomes invalid and must not be used.\n\n @param parser The parser handle to free (may be NULL)\n\n @ingroup osc"]
1658    pub fn ghostty_osc_free(parser: GhosttyOscParser_ptr);
1659}
1660unsafe extern "C" {
1661    #[doc = " Reset an OSC parser instance to its initial state.\n\n Resets the parser state, clearing any partially parsed OSC sequences\n and returning the parser to its initial state. This is useful for\n reusing a parser instance or recovering from parse errors.\n\n @param parser The parser handle to reset, must not be null.\n\n @ingroup osc"]
1662    pub fn ghostty_osc_reset(parser: GhosttyOscParser_ptr);
1663}
1664unsafe extern "C" {
1665    #[doc = " Parse the next byte in an OSC sequence.\n\n Processes a single byte as part of an OSC sequence. The parser maintains\n internal state to track the progress through the sequence. Call this\n function for each byte in the sequence data.\n\n When finished pumping the parser with bytes, call ghostty_osc_end\n to get the final result.\n\n @param parser The parser handle, must not be null.\n @param byte The next byte to parse\n\n @ingroup osc"]
1666    pub fn ghostty_osc_next(parser: GhosttyOscParser_ptr, byte: u8);
1667}
1668unsafe extern "C" {
1669    #[doc = " Finalize OSC parsing and retrieve the parsed command.\n\n Call this function after feeding all bytes of an OSC sequence to the parser\n using ghostty_osc_next() with the exception of the terminating character\n (ESC or ST). This function finalizes the parsing process and returns the\n parsed OSC command.\n\n The return value is never NULL. Invalid commands will return a command\n with type GHOSTTY_OSC_COMMAND_INVALID.\n\n The terminator parameter specifies the byte that terminated the OSC sequence\n (typically 0x07 for BEL or 0x5C for ST after ESC). This information is\n preserved in the parsed command so that responses can use the same terminator\n format for better compatibility with the calling program. For commands that\n do not require a response, this parameter is ignored and the resulting\n command will not retain the terminator information.\n\n The returned command handle is valid until the next call to any\n `ghostty_osc_*` function with the same parser instance with the exception\n of command introspection functions such as `ghostty_osc_command_type`.\n\n @param parser The parser handle, must not be null.\n @param terminator The terminating byte of the OSC sequence (0x07 for BEL, 0x5C for ST)\n @return Handle to the parsed OSC command\n\n @ingroup osc"]
1670    pub fn ghostty_osc_end(parser: GhosttyOscParser_ptr, terminator: u8) -> GhosttyOscCommand_ptr;
1671}
1672unsafe extern "C" {
1673    #[doc = " Get the type of an OSC command.\n\n Returns the type identifier for the given OSC command. This can be used\n to determine what kind of command was parsed and what data might be\n available from it.\n\n @param command The OSC command handle to query (may be NULL)\n @return The command type, or GHOSTTY_OSC_COMMAND_INVALID if command is NULL\n\n @ingroup osc"]
1674    pub fn ghostty_osc_command_type(command: GhosttyOscCommand_ptr) -> GhosttyOscCommandType;
1675}
1676unsafe extern "C" {
1677    #[doc = " Extract data from an OSC command.\n\n Extracts typed data from the given OSC command based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid command types, output types, and memory\n safety information are documented in the `GhosttyOscCommandData` enum.\n\n @param command The OSC command handle to query (may be NULL)\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return true if data extraction was successful, false otherwise\n\n @ingroup osc"]
1678    pub fn ghostty_osc_command_data(
1679        command: GhosttyOscCommand_ptr,
1680        data: GhosttyOscCommandData,
1681        out: *mut ::std::os::raw::c_void,
1682    ) -> bool;
1683}
1684#[repr(C)]
1685#[derive(Debug, Copy, Clone)]
1686pub struct GhosttySgrParser {
1687    _unused: [u8; 0],
1688}
1689#[doc = " Opaque handle to an SGR parser instance.\n\n This handle represents an SGR (Select Graphic Rendition) parser that can\n be used to parse SGR sequences and extract individual text attributes.\n\n @ingroup sgr"]
1690pub type GhosttySgrParser_ptr = *mut GhosttySgrParser;
1691pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNSET: GhosttySgrAttributeTag = 0;
1692pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNKNOWN: GhosttySgrAttributeTag = 1;
1693pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BOLD: GhosttySgrAttributeTag = 2;
1694pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_BOLD: GhosttySgrAttributeTag = 3;
1695pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_ITALIC: GhosttySgrAttributeTag = 4;
1696pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_ITALIC: GhosttySgrAttributeTag = 5;
1697pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_FAINT: GhosttySgrAttributeTag = 6;
1698pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNDERLINE: GhosttySgrAttributeTag = 7;
1699pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNDERLINE_COLOR: GhosttySgrAttributeTag = 8;
1700pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNDERLINE_COLOR_256: GhosttySgrAttributeTag = 9;
1701pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_UNDERLINE_COLOR: GhosttySgrAttributeTag =
1702    10;
1703pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_OVERLINE: GhosttySgrAttributeTag = 11;
1704pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_OVERLINE: GhosttySgrAttributeTag = 12;
1705pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BLINK: GhosttySgrAttributeTag = 13;
1706pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_BLINK: GhosttySgrAttributeTag = 14;
1707pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_INVERSE: GhosttySgrAttributeTag = 15;
1708pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_INVERSE: GhosttySgrAttributeTag = 16;
1709pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_INVISIBLE: GhosttySgrAttributeTag = 17;
1710pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_INVISIBLE: GhosttySgrAttributeTag = 18;
1711pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_STRIKETHROUGH: GhosttySgrAttributeTag = 19;
1712pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_STRIKETHROUGH: GhosttySgrAttributeTag = 20;
1713pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_DIRECT_COLOR_FG: GhosttySgrAttributeTag = 21;
1714pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_DIRECT_COLOR_BG: GhosttySgrAttributeTag = 22;
1715pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BG_8: GhosttySgrAttributeTag = 23;
1716pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_FG_8: GhosttySgrAttributeTag = 24;
1717pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_FG: GhosttySgrAttributeTag = 25;
1718pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_BG: GhosttySgrAttributeTag = 26;
1719pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BRIGHT_BG_8: GhosttySgrAttributeTag = 27;
1720pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BRIGHT_FG_8: GhosttySgrAttributeTag = 28;
1721pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BG_256: GhosttySgrAttributeTag = 29;
1722pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_FG_256: GhosttySgrAttributeTag = 30;
1723#[doc = " SGR attribute tags.\n\n These values identify the type of an SGR attribute in a tagged union.\n Use the tag to determine which field in the attribute value union to access.\n\n @ingroup sgr"]
1724pub type GhosttySgrAttributeTag = ::std::os::raw::c_uint;
1725pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_NONE: GhosttySgrUnderline = 0;
1726pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_SINGLE: GhosttySgrUnderline = 1;
1727pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_DOUBLE: GhosttySgrUnderline = 2;
1728pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_CURLY: GhosttySgrUnderline = 3;
1729pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_DOTTED: GhosttySgrUnderline = 4;
1730pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_DASHED: GhosttySgrUnderline = 5;
1731#[doc = " Underline style types.\n\n @ingroup sgr"]
1732pub type GhosttySgrUnderline = ::std::os::raw::c_uint;
1733#[doc = " Unknown SGR attribute data.\n\n Contains the full parameter list and the partial list where parsing\n encountered an unknown or invalid sequence.\n\n @ingroup sgr"]
1734#[repr(C)]
1735#[derive(Debug, Copy, Clone)]
1736pub struct GhosttySgrUnknown {
1737    pub full_ptr: *const u16,
1738    pub full_len: usize,
1739    pub partial_ptr: *const u16,
1740    pub partial_len: usize,
1741}
1742#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1743const _: () = {
1744    ["Size of GhosttySgrUnknown"][::std::mem::size_of::<GhosttySgrUnknown>() - 32usize];
1745    ["Alignment of GhosttySgrUnknown"][::std::mem::align_of::<GhosttySgrUnknown>() - 8usize];
1746    ["Offset of field: GhosttySgrUnknown::full_ptr"]
1747        [::std::mem::offset_of!(GhosttySgrUnknown, full_ptr) - 0usize];
1748    ["Offset of field: GhosttySgrUnknown::full_len"]
1749        [::std::mem::offset_of!(GhosttySgrUnknown, full_len) - 8usize];
1750    ["Offset of field: GhosttySgrUnknown::partial_ptr"]
1751        [::std::mem::offset_of!(GhosttySgrUnknown, partial_ptr) - 16usize];
1752    ["Offset of field: GhosttySgrUnknown::partial_len"]
1753        [::std::mem::offset_of!(GhosttySgrUnknown, partial_len) - 24usize];
1754};
1755impl Default for GhosttySgrUnknown {
1756    fn default() -> Self {
1757        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1758        unsafe {
1759            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1760            s.assume_init()
1761        }
1762    }
1763}
1764#[doc = " SGR attribute value union.\n\n This union contains all possible attribute values. Use the tag field\n to determine which union member is active. Attributes without associated\n data (like bold, italic) don't use the union value.\n\n @ingroup sgr"]
1765#[repr(C)]
1766#[derive(Copy, Clone)]
1767pub union GhosttySgrAttributeValue {
1768    pub unknown: GhosttySgrUnknown,
1769    pub underline: GhosttySgrUnderline,
1770    pub underline_color: GhosttyColorRgb,
1771    pub underline_color_256: GhosttyColorPaletteIndex,
1772    pub direct_color_fg: GhosttyColorRgb,
1773    pub direct_color_bg: GhosttyColorRgb,
1774    pub bg_8: GhosttyColorPaletteIndex,
1775    pub fg_8: GhosttyColorPaletteIndex,
1776    pub bright_bg_8: GhosttyColorPaletteIndex,
1777    pub bright_fg_8: GhosttyColorPaletteIndex,
1778    pub bg_256: GhosttyColorPaletteIndex,
1779    pub fg_256: GhosttyColorPaletteIndex,
1780    pub _padding: [u64; 8usize],
1781}
1782#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1783const _: () = {
1784    ["Size of GhosttySgrAttributeValue"]
1785        [::std::mem::size_of::<GhosttySgrAttributeValue>() - 64usize];
1786    ["Alignment of GhosttySgrAttributeValue"]
1787        [::std::mem::align_of::<GhosttySgrAttributeValue>() - 8usize];
1788    ["Offset of field: GhosttySgrAttributeValue::unknown"]
1789        [::std::mem::offset_of!(GhosttySgrAttributeValue, unknown) - 0usize];
1790    ["Offset of field: GhosttySgrAttributeValue::underline"]
1791        [::std::mem::offset_of!(GhosttySgrAttributeValue, underline) - 0usize];
1792    ["Offset of field: GhosttySgrAttributeValue::underline_color"]
1793        [::std::mem::offset_of!(GhosttySgrAttributeValue, underline_color) - 0usize];
1794    ["Offset of field: GhosttySgrAttributeValue::underline_color_256"]
1795        [::std::mem::offset_of!(GhosttySgrAttributeValue, underline_color_256) - 0usize];
1796    ["Offset of field: GhosttySgrAttributeValue::direct_color_fg"]
1797        [::std::mem::offset_of!(GhosttySgrAttributeValue, direct_color_fg) - 0usize];
1798    ["Offset of field: GhosttySgrAttributeValue::direct_color_bg"]
1799        [::std::mem::offset_of!(GhosttySgrAttributeValue, direct_color_bg) - 0usize];
1800    ["Offset of field: GhosttySgrAttributeValue::bg_8"]
1801        [::std::mem::offset_of!(GhosttySgrAttributeValue, bg_8) - 0usize];
1802    ["Offset of field: GhosttySgrAttributeValue::fg_8"]
1803        [::std::mem::offset_of!(GhosttySgrAttributeValue, fg_8) - 0usize];
1804    ["Offset of field: GhosttySgrAttributeValue::bright_bg_8"]
1805        [::std::mem::offset_of!(GhosttySgrAttributeValue, bright_bg_8) - 0usize];
1806    ["Offset of field: GhosttySgrAttributeValue::bright_fg_8"]
1807        [::std::mem::offset_of!(GhosttySgrAttributeValue, bright_fg_8) - 0usize];
1808    ["Offset of field: GhosttySgrAttributeValue::bg_256"]
1809        [::std::mem::offset_of!(GhosttySgrAttributeValue, bg_256) - 0usize];
1810    ["Offset of field: GhosttySgrAttributeValue::fg_256"]
1811        [::std::mem::offset_of!(GhosttySgrAttributeValue, fg_256) - 0usize];
1812    ["Offset of field: GhosttySgrAttributeValue::_padding"]
1813        [::std::mem::offset_of!(GhosttySgrAttributeValue, _padding) - 0usize];
1814};
1815impl Default for GhosttySgrAttributeValue {
1816    fn default() -> Self {
1817        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1818        unsafe {
1819            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1820            s.assume_init()
1821        }
1822    }
1823}
1824#[doc = " SGR attribute (tagged union).\n\n A complete SGR attribute with both its type tag and associated value.\n Always check the tag field to determine which value union member is valid.\n\n Attributes without associated data (e.g., GHOSTTY_SGR_ATTR_BOLD) can be\n identified by tag alone; the value union is not used for these and\n the memory in the value field is undefined.\n\n @ingroup sgr"]
1825#[repr(C)]
1826#[derive(Copy, Clone)]
1827pub struct GhosttySgrAttribute {
1828    pub tag: GhosttySgrAttributeTag,
1829    pub value: GhosttySgrAttributeValue,
1830}
1831#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1832const _: () = {
1833    ["Size of GhosttySgrAttribute"][::std::mem::size_of::<GhosttySgrAttribute>() - 72usize];
1834    ["Alignment of GhosttySgrAttribute"][::std::mem::align_of::<GhosttySgrAttribute>() - 8usize];
1835    ["Offset of field: GhosttySgrAttribute::tag"]
1836        [::std::mem::offset_of!(GhosttySgrAttribute, tag) - 0usize];
1837    ["Offset of field: GhosttySgrAttribute::value"]
1838        [::std::mem::offset_of!(GhosttySgrAttribute, value) - 8usize];
1839};
1840impl Default for GhosttySgrAttribute {
1841    fn default() -> Self {
1842        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1843        unsafe {
1844            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1845            s.assume_init()
1846        }
1847    }
1848}
1849unsafe extern "C" {
1850    #[doc = " Create a new SGR parser instance.\n\n Creates a new SGR (Select Graphic Rendition) parser using the provided\n allocator. The parser must be freed using ghostty_sgr_free() when\n no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or\n NULL to use the default allocator\n @param parser Pointer to store the created parser handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup sgr"]
1851    pub fn ghostty_sgr_new(
1852        allocator: *const GhosttyAllocator,
1853        parser: *mut GhosttySgrParser_ptr,
1854    ) -> GhosttyResult;
1855}
1856unsafe extern "C" {
1857    #[doc = " Free an SGR parser instance.\n\n Releases all resources associated with the SGR parser. After this call,\n the parser handle becomes invalid and must not be used. This includes\n any attributes previously returned by ghostty_sgr_next().\n\n @param parser The parser handle to free (may be NULL)\n\n @ingroup sgr"]
1858    pub fn ghostty_sgr_free(parser: GhosttySgrParser_ptr);
1859}
1860unsafe extern "C" {
1861    #[doc = " Reset an SGR parser instance to the beginning of the parameter list.\n\n Resets the parser's iteration state without clearing the parameters.\n After calling this, ghostty_sgr_next() will start from the beginning\n of the parameter list again.\n\n @param parser The parser handle to reset, must not be NULL\n\n @ingroup sgr"]
1862    pub fn ghostty_sgr_reset(parser: GhosttySgrParser_ptr);
1863}
1864unsafe extern "C" {
1865    #[doc = " Set SGR parameters for parsing.\n\n Sets the SGR parameter list to parse. Parameters are the numeric values\n from a CSI SGR sequence (e.g., for `ESC[1;31m`, params would be {1, 31}).\n\n The separators array optionally specifies the separator type for each\n parameter position. Each byte should be either ';' for semicolon or ':'\n for colon. This is needed for certain color formats that use colon\n separators (e.g., `ESC[4:3m` for curly underline). Any invalid separator\n values are treated as semicolons. The separators array must have the same\n length as the params array, if it is not NULL.\n\n If separators is NULL, all parameters are assumed to be semicolon-separated.\n\n This function makes an internal copy of the parameter and separator data,\n so the caller can safely free or modify the input arrays after this call.\n\n After calling this function, the parser is automatically reset and ready\n to iterate from the beginning.\n\n @param parser The parser handle, must not be NULL\n @param params Array of SGR parameter values\n @param separators Optional array of separator characters (';' or ':'), or\n NULL\n @param len Number of parameters (and separators if provided)\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup sgr"]
1866    pub fn ghostty_sgr_set_params(
1867        parser: GhosttySgrParser_ptr,
1868        params: *const u16,
1869        separators: *const ::std::os::raw::c_char,
1870        len: usize,
1871    ) -> GhosttyResult;
1872}
1873unsafe extern "C" {
1874    #[doc = " Get the next SGR attribute.\n\n Parses and returns the next attribute from the parameter list.\n Call this function repeatedly until it returns false to process\n all attributes in the sequence.\n\n @param parser The parser handle, must not be NULL\n @param attr Pointer to store the next attribute\n @return true if an attribute was returned, false if no more attributes\n\n @ingroup sgr"]
1875    pub fn ghostty_sgr_next(parser: GhosttySgrParser_ptr, attr: *mut GhosttySgrAttribute) -> bool;
1876}
1877unsafe extern "C" {
1878    #[doc = " Get the full parameter list from an unknown SGR attribute.\n\n This function retrieves the full parameter list that was provided to the\n parser when an unknown attribute was encountered. Primarily useful in\n WebAssembly environments where accessing struct fields directly is difficult.\n\n @param unknown The unknown attribute data\n @param ptr Pointer to store the pointer to the parameter array (may be NULL)\n @return The length of the full parameter array\n\n @ingroup sgr"]
1879    pub fn ghostty_sgr_unknown_full(unknown: GhosttySgrUnknown, ptr: *mut *const u16) -> usize;
1880}
1881unsafe extern "C" {
1882    #[doc = " Get the partial parameter list from an unknown SGR attribute.\n\n This function retrieves the partial parameter list where parsing stopped\n when an unknown attribute was encountered. Primarily useful in WebAssembly\n environments where accessing struct fields directly is difficult.\n\n @param unknown The unknown attribute data\n @param ptr Pointer to store the pointer to the parameter array (may be NULL)\n @return The length of the partial parameter array\n\n @ingroup sgr"]
1883    pub fn ghostty_sgr_unknown_partial(unknown: GhosttySgrUnknown, ptr: *mut *const u16) -> usize;
1884}
1885unsafe extern "C" {
1886    #[doc = " Get the tag from an SGR attribute.\n\n This function extracts the tag that identifies which type of attribute\n this is. Primarily useful in WebAssembly environments where accessing\n struct fields directly is difficult.\n\n @param attr The SGR attribute\n @return The attribute tag\n\n @ingroup sgr"]
1887    pub fn ghostty_sgr_attribute_tag(attr: GhosttySgrAttribute) -> GhosttySgrAttributeTag;
1888}
1889unsafe extern "C" {
1890    #[doc = " Get the value from an SGR attribute.\n\n This function returns a pointer to the value union from an SGR attribute. Use\n the tag to determine which field of the union is valid. Primarily useful in\n WebAssembly environments where accessing struct fields directly is difficult.\n\n @param attr Pointer to the SGR attribute\n @return Pointer to the attribute value union\n\n @ingroup sgr"]
1891    pub fn ghostty_sgr_attribute_value(
1892        attr: *mut GhosttySgrAttribute,
1893    ) -> *mut GhosttySgrAttributeValue;
1894}
1895#[repr(C)]
1896#[derive(Debug, Copy, Clone)]
1897pub struct GhosttyKeyEvent {
1898    _unused: [u8; 0],
1899}
1900#[doc = " Opaque handle to a key event.\n\n This handle represents a keyboard input event containing information about\n the physical key pressed, modifiers, and generated text.\n\n @ingroup key"]
1901pub type GhosttyKeyEvent_ptr = *mut GhosttyKeyEvent;
1902#[doc = " Key was released"]
1903pub const GhosttyKeyAction_GHOSTTY_KEY_ACTION_RELEASE: GhosttyKeyAction = 0;
1904#[doc = " Key was pressed"]
1905pub const GhosttyKeyAction_GHOSTTY_KEY_ACTION_PRESS: GhosttyKeyAction = 1;
1906#[doc = " Key is being repeated (held down)"]
1907pub const GhosttyKeyAction_GHOSTTY_KEY_ACTION_REPEAT: GhosttyKeyAction = 2;
1908#[doc = " Keyboard input event types.\n\n @ingroup key"]
1909pub type GhosttyKeyAction = ::std::os::raw::c_uint;
1910#[doc = " Keyboard modifier keys bitmask.\n\n A bitmask representing all keyboard modifiers. This tracks which modifier keys\n are pressed and, where supported by the platform, which side (left or right)\n of each modifier is active.\n\n Use the GHOSTTY_MODS_* constants to test and set individual modifiers.\n\n Modifier side bits are only meaningful when the corresponding modifier bit is set.\n Not all platforms support distinguishing between left and right modifier\n keys and Ghostty is built to expect that some platforms may not provide this\n information.\n\n @ingroup key"]
1911pub type GhosttyMods = u16;
1912pub const GhosttyKey_GHOSTTY_KEY_UNIDENTIFIED: GhosttyKey = 0;
1913pub const GhosttyKey_GHOSTTY_KEY_BACKQUOTE: GhosttyKey = 1;
1914pub const GhosttyKey_GHOSTTY_KEY_BACKSLASH: GhosttyKey = 2;
1915pub const GhosttyKey_GHOSTTY_KEY_BRACKET_LEFT: GhosttyKey = 3;
1916pub const GhosttyKey_GHOSTTY_KEY_BRACKET_RIGHT: GhosttyKey = 4;
1917pub const GhosttyKey_GHOSTTY_KEY_COMMA: GhosttyKey = 5;
1918pub const GhosttyKey_GHOSTTY_KEY_DIGIT_0: GhosttyKey = 6;
1919pub const GhosttyKey_GHOSTTY_KEY_DIGIT_1: GhosttyKey = 7;
1920pub const GhosttyKey_GHOSTTY_KEY_DIGIT_2: GhosttyKey = 8;
1921pub const GhosttyKey_GHOSTTY_KEY_DIGIT_3: GhosttyKey = 9;
1922pub const GhosttyKey_GHOSTTY_KEY_DIGIT_4: GhosttyKey = 10;
1923pub const GhosttyKey_GHOSTTY_KEY_DIGIT_5: GhosttyKey = 11;
1924pub const GhosttyKey_GHOSTTY_KEY_DIGIT_6: GhosttyKey = 12;
1925pub const GhosttyKey_GHOSTTY_KEY_DIGIT_7: GhosttyKey = 13;
1926pub const GhosttyKey_GHOSTTY_KEY_DIGIT_8: GhosttyKey = 14;
1927pub const GhosttyKey_GHOSTTY_KEY_DIGIT_9: GhosttyKey = 15;
1928pub const GhosttyKey_GHOSTTY_KEY_EQUAL: GhosttyKey = 16;
1929pub const GhosttyKey_GHOSTTY_KEY_INTL_BACKSLASH: GhosttyKey = 17;
1930pub const GhosttyKey_GHOSTTY_KEY_INTL_RO: GhosttyKey = 18;
1931pub const GhosttyKey_GHOSTTY_KEY_INTL_YEN: GhosttyKey = 19;
1932pub const GhosttyKey_GHOSTTY_KEY_A: GhosttyKey = 20;
1933pub const GhosttyKey_GHOSTTY_KEY_B: GhosttyKey = 21;
1934pub const GhosttyKey_GHOSTTY_KEY_C: GhosttyKey = 22;
1935pub const GhosttyKey_GHOSTTY_KEY_D: GhosttyKey = 23;
1936pub const GhosttyKey_GHOSTTY_KEY_E: GhosttyKey = 24;
1937pub const GhosttyKey_GHOSTTY_KEY_F: GhosttyKey = 25;
1938pub const GhosttyKey_GHOSTTY_KEY_G: GhosttyKey = 26;
1939pub const GhosttyKey_GHOSTTY_KEY_H: GhosttyKey = 27;
1940pub const GhosttyKey_GHOSTTY_KEY_I: GhosttyKey = 28;
1941pub const GhosttyKey_GHOSTTY_KEY_J: GhosttyKey = 29;
1942pub const GhosttyKey_GHOSTTY_KEY_K: GhosttyKey = 30;
1943pub const GhosttyKey_GHOSTTY_KEY_L: GhosttyKey = 31;
1944pub const GhosttyKey_GHOSTTY_KEY_M: GhosttyKey = 32;
1945pub const GhosttyKey_GHOSTTY_KEY_N: GhosttyKey = 33;
1946pub const GhosttyKey_GHOSTTY_KEY_O: GhosttyKey = 34;
1947pub const GhosttyKey_GHOSTTY_KEY_P: GhosttyKey = 35;
1948pub const GhosttyKey_GHOSTTY_KEY_Q: GhosttyKey = 36;
1949pub const GhosttyKey_GHOSTTY_KEY_R: GhosttyKey = 37;
1950pub const GhosttyKey_GHOSTTY_KEY_S: GhosttyKey = 38;
1951pub const GhosttyKey_GHOSTTY_KEY_T: GhosttyKey = 39;
1952pub const GhosttyKey_GHOSTTY_KEY_U: GhosttyKey = 40;
1953pub const GhosttyKey_GHOSTTY_KEY_V: GhosttyKey = 41;
1954pub const GhosttyKey_GHOSTTY_KEY_W: GhosttyKey = 42;
1955pub const GhosttyKey_GHOSTTY_KEY_X: GhosttyKey = 43;
1956pub const GhosttyKey_GHOSTTY_KEY_Y: GhosttyKey = 44;
1957pub const GhosttyKey_GHOSTTY_KEY_Z: GhosttyKey = 45;
1958pub const GhosttyKey_GHOSTTY_KEY_MINUS: GhosttyKey = 46;
1959pub const GhosttyKey_GHOSTTY_KEY_PERIOD: GhosttyKey = 47;
1960pub const GhosttyKey_GHOSTTY_KEY_QUOTE: GhosttyKey = 48;
1961pub const GhosttyKey_GHOSTTY_KEY_SEMICOLON: GhosttyKey = 49;
1962pub const GhosttyKey_GHOSTTY_KEY_SLASH: GhosttyKey = 50;
1963pub const GhosttyKey_GHOSTTY_KEY_ALT_LEFT: GhosttyKey = 51;
1964pub const GhosttyKey_GHOSTTY_KEY_ALT_RIGHT: GhosttyKey = 52;
1965pub const GhosttyKey_GHOSTTY_KEY_BACKSPACE: GhosttyKey = 53;
1966pub const GhosttyKey_GHOSTTY_KEY_CAPS_LOCK: GhosttyKey = 54;
1967pub const GhosttyKey_GHOSTTY_KEY_CONTEXT_MENU: GhosttyKey = 55;
1968pub const GhosttyKey_GHOSTTY_KEY_CONTROL_LEFT: GhosttyKey = 56;
1969pub const GhosttyKey_GHOSTTY_KEY_CONTROL_RIGHT: GhosttyKey = 57;
1970pub const GhosttyKey_GHOSTTY_KEY_ENTER: GhosttyKey = 58;
1971pub const GhosttyKey_GHOSTTY_KEY_META_LEFT: GhosttyKey = 59;
1972pub const GhosttyKey_GHOSTTY_KEY_META_RIGHT: GhosttyKey = 60;
1973pub const GhosttyKey_GHOSTTY_KEY_SHIFT_LEFT: GhosttyKey = 61;
1974pub const GhosttyKey_GHOSTTY_KEY_SHIFT_RIGHT: GhosttyKey = 62;
1975pub const GhosttyKey_GHOSTTY_KEY_SPACE: GhosttyKey = 63;
1976pub const GhosttyKey_GHOSTTY_KEY_TAB: GhosttyKey = 64;
1977pub const GhosttyKey_GHOSTTY_KEY_CONVERT: GhosttyKey = 65;
1978pub const GhosttyKey_GHOSTTY_KEY_KANA_MODE: GhosttyKey = 66;
1979pub const GhosttyKey_GHOSTTY_KEY_NON_CONVERT: GhosttyKey = 67;
1980pub const GhosttyKey_GHOSTTY_KEY_DELETE: GhosttyKey = 68;
1981pub const GhosttyKey_GHOSTTY_KEY_END: GhosttyKey = 69;
1982pub const GhosttyKey_GHOSTTY_KEY_HELP: GhosttyKey = 70;
1983pub const GhosttyKey_GHOSTTY_KEY_HOME: GhosttyKey = 71;
1984pub const GhosttyKey_GHOSTTY_KEY_INSERT: GhosttyKey = 72;
1985pub const GhosttyKey_GHOSTTY_KEY_PAGE_DOWN: GhosttyKey = 73;
1986pub const GhosttyKey_GHOSTTY_KEY_PAGE_UP: GhosttyKey = 74;
1987pub const GhosttyKey_GHOSTTY_KEY_ARROW_DOWN: GhosttyKey = 75;
1988pub const GhosttyKey_GHOSTTY_KEY_ARROW_LEFT: GhosttyKey = 76;
1989pub const GhosttyKey_GHOSTTY_KEY_ARROW_RIGHT: GhosttyKey = 77;
1990pub const GhosttyKey_GHOSTTY_KEY_ARROW_UP: GhosttyKey = 78;
1991pub const GhosttyKey_GHOSTTY_KEY_NUM_LOCK: GhosttyKey = 79;
1992pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_0: GhosttyKey = 80;
1993pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_1: GhosttyKey = 81;
1994pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_2: GhosttyKey = 82;
1995pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_3: GhosttyKey = 83;
1996pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_4: GhosttyKey = 84;
1997pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_5: GhosttyKey = 85;
1998pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_6: GhosttyKey = 86;
1999pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_7: GhosttyKey = 87;
2000pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_8: GhosttyKey = 88;
2001pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_9: GhosttyKey = 89;
2002pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_ADD: GhosttyKey = 90;
2003pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_BACKSPACE: GhosttyKey = 91;
2004pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_CLEAR: GhosttyKey = 92;
2005pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_CLEAR_ENTRY: GhosttyKey = 93;
2006pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_COMMA: GhosttyKey = 94;
2007pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DECIMAL: GhosttyKey = 95;
2008pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DIVIDE: GhosttyKey = 96;
2009pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_ENTER: GhosttyKey = 97;
2010pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_EQUAL: GhosttyKey = 98;
2011pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_ADD: GhosttyKey = 99;
2012pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_CLEAR: GhosttyKey = 100;
2013pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_RECALL: GhosttyKey = 101;
2014pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_STORE: GhosttyKey = 102;
2015pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_SUBTRACT: GhosttyKey = 103;
2016pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MULTIPLY: GhosttyKey = 104;
2017pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAREN_LEFT: GhosttyKey = 105;
2018pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAREN_RIGHT: GhosttyKey = 106;
2019pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_SUBTRACT: GhosttyKey = 107;
2020pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_SEPARATOR: GhosttyKey = 108;
2021pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_UP: GhosttyKey = 109;
2022pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DOWN: GhosttyKey = 110;
2023pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_RIGHT: GhosttyKey = 111;
2024pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_LEFT: GhosttyKey = 112;
2025pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_BEGIN: GhosttyKey = 113;
2026pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_HOME: GhosttyKey = 114;
2027pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_END: GhosttyKey = 115;
2028pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_INSERT: GhosttyKey = 116;
2029pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DELETE: GhosttyKey = 117;
2030pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAGE_UP: GhosttyKey = 118;
2031pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAGE_DOWN: GhosttyKey = 119;
2032pub const GhosttyKey_GHOSTTY_KEY_ESCAPE: GhosttyKey = 120;
2033pub const GhosttyKey_GHOSTTY_KEY_F1: GhosttyKey = 121;
2034pub const GhosttyKey_GHOSTTY_KEY_F2: GhosttyKey = 122;
2035pub const GhosttyKey_GHOSTTY_KEY_F3: GhosttyKey = 123;
2036pub const GhosttyKey_GHOSTTY_KEY_F4: GhosttyKey = 124;
2037pub const GhosttyKey_GHOSTTY_KEY_F5: GhosttyKey = 125;
2038pub const GhosttyKey_GHOSTTY_KEY_F6: GhosttyKey = 126;
2039pub const GhosttyKey_GHOSTTY_KEY_F7: GhosttyKey = 127;
2040pub const GhosttyKey_GHOSTTY_KEY_F8: GhosttyKey = 128;
2041pub const GhosttyKey_GHOSTTY_KEY_F9: GhosttyKey = 129;
2042pub const GhosttyKey_GHOSTTY_KEY_F10: GhosttyKey = 130;
2043pub const GhosttyKey_GHOSTTY_KEY_F11: GhosttyKey = 131;
2044pub const GhosttyKey_GHOSTTY_KEY_F12: GhosttyKey = 132;
2045pub const GhosttyKey_GHOSTTY_KEY_F13: GhosttyKey = 133;
2046pub const GhosttyKey_GHOSTTY_KEY_F14: GhosttyKey = 134;
2047pub const GhosttyKey_GHOSTTY_KEY_F15: GhosttyKey = 135;
2048pub const GhosttyKey_GHOSTTY_KEY_F16: GhosttyKey = 136;
2049pub const GhosttyKey_GHOSTTY_KEY_F17: GhosttyKey = 137;
2050pub const GhosttyKey_GHOSTTY_KEY_F18: GhosttyKey = 138;
2051pub const GhosttyKey_GHOSTTY_KEY_F19: GhosttyKey = 139;
2052pub const GhosttyKey_GHOSTTY_KEY_F20: GhosttyKey = 140;
2053pub const GhosttyKey_GHOSTTY_KEY_F21: GhosttyKey = 141;
2054pub const GhosttyKey_GHOSTTY_KEY_F22: GhosttyKey = 142;
2055pub const GhosttyKey_GHOSTTY_KEY_F23: GhosttyKey = 143;
2056pub const GhosttyKey_GHOSTTY_KEY_F24: GhosttyKey = 144;
2057pub const GhosttyKey_GHOSTTY_KEY_F25: GhosttyKey = 145;
2058pub const GhosttyKey_GHOSTTY_KEY_FN: GhosttyKey = 146;
2059pub const GhosttyKey_GHOSTTY_KEY_FN_LOCK: GhosttyKey = 147;
2060pub const GhosttyKey_GHOSTTY_KEY_PRINT_SCREEN: GhosttyKey = 148;
2061pub const GhosttyKey_GHOSTTY_KEY_SCROLL_LOCK: GhosttyKey = 149;
2062pub const GhosttyKey_GHOSTTY_KEY_PAUSE: GhosttyKey = 150;
2063pub const GhosttyKey_GHOSTTY_KEY_BROWSER_BACK: GhosttyKey = 151;
2064pub const GhosttyKey_GHOSTTY_KEY_BROWSER_FAVORITES: GhosttyKey = 152;
2065pub const GhosttyKey_GHOSTTY_KEY_BROWSER_FORWARD: GhosttyKey = 153;
2066pub const GhosttyKey_GHOSTTY_KEY_BROWSER_HOME: GhosttyKey = 154;
2067pub const GhosttyKey_GHOSTTY_KEY_BROWSER_REFRESH: GhosttyKey = 155;
2068pub const GhosttyKey_GHOSTTY_KEY_BROWSER_SEARCH: GhosttyKey = 156;
2069pub const GhosttyKey_GHOSTTY_KEY_BROWSER_STOP: GhosttyKey = 157;
2070pub const GhosttyKey_GHOSTTY_KEY_EJECT: GhosttyKey = 158;
2071pub const GhosttyKey_GHOSTTY_KEY_LAUNCH_APP_1: GhosttyKey = 159;
2072pub const GhosttyKey_GHOSTTY_KEY_LAUNCH_APP_2: GhosttyKey = 160;
2073pub const GhosttyKey_GHOSTTY_KEY_LAUNCH_MAIL: GhosttyKey = 161;
2074pub const GhosttyKey_GHOSTTY_KEY_MEDIA_PLAY_PAUSE: GhosttyKey = 162;
2075pub const GhosttyKey_GHOSTTY_KEY_MEDIA_SELECT: GhosttyKey = 163;
2076pub const GhosttyKey_GHOSTTY_KEY_MEDIA_STOP: GhosttyKey = 164;
2077pub const GhosttyKey_GHOSTTY_KEY_MEDIA_TRACK_NEXT: GhosttyKey = 165;
2078pub const GhosttyKey_GHOSTTY_KEY_MEDIA_TRACK_PREVIOUS: GhosttyKey = 166;
2079pub const GhosttyKey_GHOSTTY_KEY_POWER: GhosttyKey = 167;
2080pub const GhosttyKey_GHOSTTY_KEY_SLEEP: GhosttyKey = 168;
2081pub const GhosttyKey_GHOSTTY_KEY_AUDIO_VOLUME_DOWN: GhosttyKey = 169;
2082pub const GhosttyKey_GHOSTTY_KEY_AUDIO_VOLUME_MUTE: GhosttyKey = 170;
2083pub const GhosttyKey_GHOSTTY_KEY_AUDIO_VOLUME_UP: GhosttyKey = 171;
2084pub const GhosttyKey_GHOSTTY_KEY_WAKE_UP: GhosttyKey = 172;
2085pub const GhosttyKey_GHOSTTY_KEY_COPY: GhosttyKey = 173;
2086pub const GhosttyKey_GHOSTTY_KEY_CUT: GhosttyKey = 174;
2087pub const GhosttyKey_GHOSTTY_KEY_PASTE: GhosttyKey = 175;
2088#[doc = " Physical key codes.\n\n The set of key codes that Ghostty is aware of. These represent physical keys\n on the keyboard and are layout-independent. For example, the \"a\" key on a US\n keyboard is the same as the \"ф\" key on a Russian keyboard, but both will\n report the same key_a value.\n\n Layout-dependent strings are provided separately as UTF-8 text and are produced\n by the platform. These values are based on the W3C UI Events KeyboardEvent code\n standard. See: https://www.w3.org/TR/uievents-code\n\n @ingroup key"]
2089pub type GhosttyKey = ::std::os::raw::c_uint;
2090unsafe extern "C" {
2091    #[doc = " Create a new key event instance.\n\n Creates a new key event with default values. The event must be freed using\n ghostty_key_event_free() when no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator\n @param event Pointer to store the created key event handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup key"]
2092    pub fn ghostty_key_event_new(
2093        allocator: *const GhosttyAllocator,
2094        event: *mut GhosttyKeyEvent_ptr,
2095    ) -> GhosttyResult;
2096}
2097unsafe extern "C" {
2098    #[doc = " Free a key event instance.\n\n Releases all resources associated with the key event. After this call,\n the event handle becomes invalid and must not be used.\n\n @param event The key event handle to free (may be NULL)\n\n @ingroup key"]
2099    pub fn ghostty_key_event_free(event: GhosttyKeyEvent_ptr);
2100}
2101unsafe extern "C" {
2102    #[doc = " Set the key action (press, release, repeat).\n\n @param event The key event handle, must not be NULL\n @param action The action to set\n\n @ingroup key"]
2103    pub fn ghostty_key_event_set_action(event: GhosttyKeyEvent_ptr, action: GhosttyKeyAction);
2104}
2105unsafe extern "C" {
2106    #[doc = " Get the key action (press, release, repeat).\n\n @param event The key event handle, must not be NULL\n @return The key action\n\n @ingroup key"]
2107    pub fn ghostty_key_event_get_action(event: GhosttyKeyEvent_ptr) -> GhosttyKeyAction;
2108}
2109unsafe extern "C" {
2110    #[doc = " Set the physical key code.\n\n @param event The key event handle, must not be NULL\n @param key The physical key code to set\n\n @ingroup key"]
2111    pub fn ghostty_key_event_set_key(event: GhosttyKeyEvent_ptr, key: GhosttyKey);
2112}
2113unsafe extern "C" {
2114    #[doc = " Get the physical key code.\n\n @param event The key event handle, must not be NULL\n @return The physical key code\n\n @ingroup key"]
2115    pub fn ghostty_key_event_get_key(event: GhosttyKeyEvent_ptr) -> GhosttyKey;
2116}
2117unsafe extern "C" {
2118    #[doc = " Set the modifier keys bitmask.\n\n @param event The key event handle, must not be NULL\n @param mods The modifier keys bitmask to set\n\n @ingroup key"]
2119    pub fn ghostty_key_event_set_mods(event: GhosttyKeyEvent_ptr, mods: GhosttyMods);
2120}
2121unsafe extern "C" {
2122    #[doc = " Get the modifier keys bitmask.\n\n @param event The key event handle, must not be NULL\n @return The modifier keys bitmask\n\n @ingroup key"]
2123    pub fn ghostty_key_event_get_mods(event: GhosttyKeyEvent_ptr) -> GhosttyMods;
2124}
2125unsafe extern "C" {
2126    #[doc = " Set the consumed modifiers bitmask.\n\n @param event The key event handle, must not be NULL\n @param consumed_mods The consumed modifiers bitmask to set\n\n @ingroup key"]
2127    pub fn ghostty_key_event_set_consumed_mods(
2128        event: GhosttyKeyEvent_ptr,
2129        consumed_mods: GhosttyMods,
2130    );
2131}
2132unsafe extern "C" {
2133    #[doc = " Get the consumed modifiers bitmask.\n\n @param event The key event handle, must not be NULL\n @return The consumed modifiers bitmask\n\n @ingroup key"]
2134    pub fn ghostty_key_event_get_consumed_mods(event: GhosttyKeyEvent_ptr) -> GhosttyMods;
2135}
2136unsafe extern "C" {
2137    #[doc = " Set whether the key event is part of a composition sequence.\n\n @param event The key event handle, must not be NULL\n @param composing Whether the key event is part of a composition sequence\n\n @ingroup key"]
2138    pub fn ghostty_key_event_set_composing(event: GhosttyKeyEvent_ptr, composing: bool);
2139}
2140unsafe extern "C" {
2141    #[doc = " Get whether the key event is part of a composition sequence.\n\n @param event The key event handle, must not be NULL\n @return Whether the key event is part of a composition sequence\n\n @ingroup key"]
2142    pub fn ghostty_key_event_get_composing(event: GhosttyKeyEvent_ptr) -> bool;
2143}
2144unsafe extern "C" {
2145    #[doc = " Set the UTF-8 text generated by the key event.\n\n The key event does NOT take ownership of the text pointer. The caller\n must ensure the string remains valid for the lifetime needed by the event.\n\n @param event The key event handle, must not be NULL\n @param utf8 The UTF-8 text to set (or NULL for empty)\n @param len Length of the UTF-8 text in bytes\n\n @ingroup key"]
2146    pub fn ghostty_key_event_set_utf8(
2147        event: GhosttyKeyEvent_ptr,
2148        utf8: *const ::std::os::raw::c_char,
2149        len: usize,
2150    );
2151}
2152unsafe extern "C" {
2153    #[doc = " Get the UTF-8 text generated by the key event.\n\n The returned pointer is valid until the event is freed or the UTF-8 text is modified.\n\n @param event The key event handle, must not be NULL\n @param len Pointer to store the length of the UTF-8 text in bytes (may be NULL)\n @return The UTF-8 text (or NULL for empty)\n\n @ingroup key"]
2154    pub fn ghostty_key_event_get_utf8(
2155        event: GhosttyKeyEvent_ptr,
2156        len: *mut usize,
2157    ) -> *const ::std::os::raw::c_char;
2158}
2159unsafe extern "C" {
2160    #[doc = " Set the unshifted Unicode codepoint.\n\n @param event The key event handle, must not be NULL\n @param codepoint The unshifted Unicode codepoint to set\n\n @ingroup key"]
2161    pub fn ghostty_key_event_set_unshifted_codepoint(event: GhosttyKeyEvent_ptr, codepoint: u32);
2162}
2163unsafe extern "C" {
2164    #[doc = " Get the unshifted Unicode codepoint.\n\n @param event The key event handle, must not be NULL\n @return The unshifted Unicode codepoint\n\n @ingroup key"]
2165    pub fn ghostty_key_event_get_unshifted_codepoint(event: GhosttyKeyEvent_ptr) -> u32;
2166}
2167#[repr(C)]
2168#[derive(Debug, Copy, Clone)]
2169pub struct GhosttyKeyEncoder {
2170    _unused: [u8; 0],
2171}
2172#[doc = " Opaque handle to a key encoder instance.\n\n This handle represents a key encoder that converts key events into terminal\n escape sequences.\n\n @ingroup key"]
2173pub type GhosttyKeyEncoder_ptr = *mut GhosttyKeyEncoder;
2174#[doc = " Kitty keyboard protocol flags.\n\n Bitflags representing the various modes of the Kitty keyboard protocol.\n These can be combined using bitwise OR operations. Valid values all\n start with `GHOSTTY_KITTY_KEY_`.\n\n @ingroup key"]
2175pub type GhosttyKittyKeyFlags = u8;
2176#[doc = " Option key is not treated as alt"]
2177pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_FALSE: GhosttyOptionAsAlt = 0;
2178#[doc = " Option key is treated as alt"]
2179pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_TRUE: GhosttyOptionAsAlt = 1;
2180#[doc = " Only left option key is treated as alt"]
2181pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_LEFT: GhosttyOptionAsAlt = 2;
2182#[doc = " Only right option key is treated as alt"]
2183pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_RIGHT: GhosttyOptionAsAlt = 3;
2184#[doc = " macOS option key behavior.\n\n Determines whether the \"option\" key on macOS is treated as \"alt\" or not.\n See the Ghostty `macos-option-as-alt` configuration option for more details.\n\n @ingroup key"]
2185pub type GhosttyOptionAsAlt = ::std::os::raw::c_uint;
2186#[doc = " Terminal DEC mode 1: cursor key application mode (value: bool)"]
2187pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION:
2188    GhosttyKeyEncoderOption = 0;
2189#[doc = " Terminal DEC mode 66: keypad key application mode (value: bool)"]
2190pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION:
2191    GhosttyKeyEncoderOption = 1;
2192#[doc = " Terminal DEC mode 1035: ignore keypad with numlock (value: bool)"]
2193pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK:
2194    GhosttyKeyEncoderOption = 2;
2195#[doc = " Terminal DEC mode 1036: alt sends escape prefix (value: bool)"]
2196pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX: GhosttyKeyEncoderOption =
2197    3;
2198#[doc = " xterm modifyOtherKeys mode 2 (value: bool)"]
2199pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2:
2200    GhosttyKeyEncoderOption = 4;
2201#[doc = " Kitty keyboard protocol flags (value: GhosttyKittyKeyFlags bitmask)"]
2202pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS: GhosttyKeyEncoderOption = 5;
2203#[doc = " macOS option-as-alt setting (value: GhosttyOptionAsAlt)"]
2204pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT:
2205    GhosttyKeyEncoderOption = 6;
2206#[doc = " Key encoder option identifiers.\n\n These values are used with ghostty_key_encoder_setopt() to configure\n the behavior of the key encoder.\n\n @ingroup key"]
2207pub type GhosttyKeyEncoderOption = ::std::os::raw::c_uint;
2208unsafe extern "C" {
2209    #[doc = " Create a new key encoder instance.\n\n Creates a new key encoder with default options. The encoder can be configured\n using ghostty_key_encoder_setopt() and must be freed using\n ghostty_key_encoder_free() when no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator\n @param encoder Pointer to store the created encoder handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup key"]
2210    pub fn ghostty_key_encoder_new(
2211        allocator: *const GhosttyAllocator,
2212        encoder: *mut GhosttyKeyEncoder_ptr,
2213    ) -> GhosttyResult;
2214}
2215unsafe extern "C" {
2216    #[doc = " Free a key encoder instance.\n\n Releases all resources associated with the key encoder. After this call,\n the encoder handle becomes invalid and must not be used.\n\n @param encoder The encoder handle to free (may be NULL)\n\n @ingroup key"]
2217    pub fn ghostty_key_encoder_free(encoder: GhosttyKeyEncoder_ptr);
2218}
2219unsafe extern "C" {
2220    #[doc = " Set an option on the key encoder.\n\n Configures the behavior of the key encoder. Options control various aspects\n of encoding such as terminal modes (cursor key application mode, keypad mode),\n protocol selection (Kitty keyboard protocol flags), and platform-specific\n behaviors (macOS option-as-alt).\n\n If you are using a terminal instance, you can set the key encoding\n options based on the active terminal state (e.g. legacy vs Kitty mode\n and associated flags) with ghostty_key_encoder_setopt_from_terminal().\n\n A null pointer value does nothing. It does not reset the value to the\n default. The setopt call will do nothing.\n\n @param encoder The encoder handle, must not be NULL\n @param option The option to set\n @param value Pointer to the value to set (type depends on the option)\n\n @ingroup key"]
2221    pub fn ghostty_key_encoder_setopt(
2222        encoder: GhosttyKeyEncoder_ptr,
2223        option: GhosttyKeyEncoderOption,
2224        value: *const ::std::os::raw::c_void,
2225    );
2226}
2227unsafe extern "C" {
2228    #[doc = " Set encoder options from a terminal's current state.\n\n Reads the terminal's current modes and flags and applies them to the\n encoder's options. This sets cursor key application mode, keypad mode,\n alt escape prefix, modifyOtherKeys state, and Kitty keyboard protocol\n flags from the terminal state.\n\n Note that the `macos_option_as_alt` option cannot be determined from\n terminal state and is reset to `GHOSTTY_OPTION_AS_ALT_FALSE` by this\n call. Use ghostty_key_encoder_setopt() to set it afterward if needed.\n\n @param encoder The encoder handle, must not be NULL\n @param terminal The terminal handle, must not be NULL\n\n @ingroup key"]
2229    pub fn ghostty_key_encoder_setopt_from_terminal(
2230        encoder: GhosttyKeyEncoder_ptr,
2231        terminal: GhosttyTerminal_ptr,
2232    );
2233}
2234unsafe extern "C" {
2235    #[doc = " Encode a key event into a terminal escape sequence.\n\n Converts a key event into the appropriate terminal escape sequence based on\n the encoder's current options. The sequence is written to the provided buffer.\n\n Not all key events produce output. For example, unmodified modifier keys\n typically don't generate escape sequences. Check the out_len parameter to\n determine if any data was written.\n\n If the output buffer is too small, this function returns GHOSTTY_OUT_OF_SPACE\n and out_len will contain the required buffer size. The caller can then\n allocate a larger buffer and call the function again.\n\n @param encoder The encoder handle, must not be NULL\n @param event The key event to encode, must not be NULL\n @param out_buf Buffer to write the encoded sequence to\n @param out_buf_size Size of the output buffer in bytes\n @param out_len Pointer to store the number of bytes written (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if buffer too small, or other error code\n\n ## Example: Calculate required buffer size\n\n @code{.c}\n // Query the required size with a NULL buffer (always returns OUT_OF_SPACE)\n size_t required = 0;\n GhosttyResult result = ghostty_key_encoder_encode(encoder, event, NULL, 0, &required);\n assert(result == GHOSTTY_OUT_OF_SPACE);\n\n // Allocate buffer of required size\n char *buf = malloc(required);\n\n // Encode with properly sized buffer\n size_t written = 0;\n result = ghostty_key_encoder_encode(encoder, event, buf, required, &written);\n assert(result == GHOSTTY_SUCCESS);\n\n // Use the encoded sequence...\n\n free(buf);\n @endcode\n\n ## Example: Direct encoding with static buffer\n\n @code{.c}\n // Most escape sequences are short, so a static buffer often suffices\n char buf[128];\n size_t written = 0;\n GhosttyResult result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written);\n\n if (result == GHOSTTY_SUCCESS) {\n   // Write the encoded sequence to the terminal\n   write(pty_fd, buf, written);\n } else if (result == GHOSTTY_OUT_OF_SPACE) {\n   // Buffer too small, written contains required size\n   char *dynamic_buf = malloc(written);\n   result = ghostty_key_encoder_encode(encoder, event, dynamic_buf, written, &written);\n   assert(result == GHOSTTY_SUCCESS);\n   write(pty_fd, dynamic_buf, written);\n   free(dynamic_buf);\n }\n @endcode\n\n @ingroup key"]
2236    pub fn ghostty_key_encoder_encode(
2237        encoder: GhosttyKeyEncoder_ptr,
2238        event: GhosttyKeyEvent_ptr,
2239        out_buf: *mut ::std::os::raw::c_char,
2240        out_buf_size: usize,
2241        out_len: *mut usize,
2242    ) -> GhosttyResult;
2243}
2244#[repr(C)]
2245#[derive(Debug, Copy, Clone)]
2246pub struct GhosttyMouseEvent {
2247    _unused: [u8; 0],
2248}
2249#[doc = " Opaque handle to a mouse event.\n\n This handle represents a normalized mouse input event containing\n action, button, modifiers, and surface-space position.\n\n @ingroup mouse"]
2250pub type GhosttyMouseEvent_ptr = *mut GhosttyMouseEvent;
2251#[doc = " Mouse button was pressed."]
2252pub const GhosttyMouseAction_GHOSTTY_MOUSE_ACTION_PRESS: GhosttyMouseAction = 0;
2253#[doc = " Mouse button was released."]
2254pub const GhosttyMouseAction_GHOSTTY_MOUSE_ACTION_RELEASE: GhosttyMouseAction = 1;
2255#[doc = " Mouse moved."]
2256pub const GhosttyMouseAction_GHOSTTY_MOUSE_ACTION_MOTION: GhosttyMouseAction = 2;
2257#[doc = " Mouse event action type.\n\n @ingroup mouse"]
2258pub type GhosttyMouseAction = ::std::os::raw::c_uint;
2259pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_UNKNOWN: GhosttyMouseButton = 0;
2260pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_LEFT: GhosttyMouseButton = 1;
2261pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_RIGHT: GhosttyMouseButton = 2;
2262pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_MIDDLE: GhosttyMouseButton = 3;
2263pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_FOUR: GhosttyMouseButton = 4;
2264pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_FIVE: GhosttyMouseButton = 5;
2265pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_SIX: GhosttyMouseButton = 6;
2266pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_SEVEN: GhosttyMouseButton = 7;
2267pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_EIGHT: GhosttyMouseButton = 8;
2268pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_NINE: GhosttyMouseButton = 9;
2269pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_TEN: GhosttyMouseButton = 10;
2270pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_ELEVEN: GhosttyMouseButton = 11;
2271#[doc = " Mouse button identity.\n\n @ingroup mouse"]
2272pub type GhosttyMouseButton = ::std::os::raw::c_uint;
2273#[doc = " Mouse position in surface-space pixels.\n\n @ingroup mouse"]
2274#[repr(C)]
2275#[derive(Debug, Default, Copy, Clone)]
2276pub struct GhosttyMousePosition {
2277    pub x: f32,
2278    pub y: f32,
2279}
2280#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2281const _: () = {
2282    ["Size of GhosttyMousePosition"][::std::mem::size_of::<GhosttyMousePosition>() - 8usize];
2283    ["Alignment of GhosttyMousePosition"][::std::mem::align_of::<GhosttyMousePosition>() - 4usize];
2284    ["Offset of field: GhosttyMousePosition::x"]
2285        [::std::mem::offset_of!(GhosttyMousePosition, x) - 0usize];
2286    ["Offset of field: GhosttyMousePosition::y"]
2287        [::std::mem::offset_of!(GhosttyMousePosition, y) - 4usize];
2288};
2289unsafe extern "C" {
2290    #[doc = " Create a new mouse event instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param event Pointer to store the created event handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup mouse"]
2291    pub fn ghostty_mouse_event_new(
2292        allocator: *const GhosttyAllocator,
2293        event: *mut GhosttyMouseEvent_ptr,
2294    ) -> GhosttyResult;
2295}
2296unsafe extern "C" {
2297    #[doc = " Free a mouse event instance.\n\n @param event The mouse event handle to free (may be NULL)\n\n @ingroup mouse"]
2298    pub fn ghostty_mouse_event_free(event: GhosttyMouseEvent_ptr);
2299}
2300unsafe extern "C" {
2301    #[doc = " Set the event action.\n\n @param event The event handle, must not be NULL\n @param action The action to set\n\n @ingroup mouse"]
2302    pub fn ghostty_mouse_event_set_action(event: GhosttyMouseEvent_ptr, action: GhosttyMouseAction);
2303}
2304unsafe extern "C" {
2305    #[doc = " Get the event action.\n\n @param event The event handle, must not be NULL\n @return The event action\n\n @ingroup mouse"]
2306    pub fn ghostty_mouse_event_get_action(event: GhosttyMouseEvent_ptr) -> GhosttyMouseAction;
2307}
2308unsafe extern "C" {
2309    #[doc = " Set the event button.\n\n This sets a concrete button identity for the event.\n To represent \"no button\" (for motion events), use\n ghostty_mouse_event_clear_button().\n\n @param event The event handle, must not be NULL\n @param button The button to set\n\n @ingroup mouse"]
2310    pub fn ghostty_mouse_event_set_button(event: GhosttyMouseEvent_ptr, button: GhosttyMouseButton);
2311}
2312unsafe extern "C" {
2313    #[doc = " Clear the event button.\n\n This sets the event button to \"none\".\n\n @param event The event handle, must not be NULL\n\n @ingroup mouse"]
2314    pub fn ghostty_mouse_event_clear_button(event: GhosttyMouseEvent_ptr);
2315}
2316unsafe extern "C" {
2317    #[doc = " Get the event button.\n\n @param event The event handle, must not be NULL\n @param out_button Output pointer for the button value (may be NULL)\n @return true if a button is set, false if no button is set\n\n @ingroup mouse"]
2318    pub fn ghostty_mouse_event_get_button(
2319        event: GhosttyMouseEvent_ptr,
2320        out_button: *mut GhosttyMouseButton,
2321    ) -> bool;
2322}
2323unsafe extern "C" {
2324    #[doc = " Set keyboard modifiers held during the event.\n\n @param event The event handle, must not be NULL\n @param mods Modifier bitmask\n\n @ingroup mouse"]
2325    pub fn ghostty_mouse_event_set_mods(event: GhosttyMouseEvent_ptr, mods: GhosttyMods);
2326}
2327unsafe extern "C" {
2328    #[doc = " Get keyboard modifiers held during the event.\n\n @param event The event handle, must not be NULL\n @return Modifier bitmask\n\n @ingroup mouse"]
2329    pub fn ghostty_mouse_event_get_mods(event: GhosttyMouseEvent_ptr) -> GhosttyMods;
2330}
2331unsafe extern "C" {
2332    #[doc = " Set the event position in surface-space pixels.\n\n @param event The event handle, must not be NULL\n @param position The position to set\n\n @ingroup mouse"]
2333    pub fn ghostty_mouse_event_set_position(
2334        event: GhosttyMouseEvent_ptr,
2335        position: GhosttyMousePosition,
2336    );
2337}
2338unsafe extern "C" {
2339    #[doc = " Get the event position in surface-space pixels.\n\n @param event The event handle, must not be NULL\n @return The current event position\n\n @ingroup mouse"]
2340    pub fn ghostty_mouse_event_get_position(event: GhosttyMouseEvent_ptr) -> GhosttyMousePosition;
2341}
2342#[repr(C)]
2343#[derive(Debug, Copy, Clone)]
2344pub struct GhosttyMouseEncoder {
2345    _unused: [u8; 0],
2346}
2347#[doc = " Opaque handle to a mouse encoder instance.\n\n This handle represents a mouse encoder that converts normalized\n mouse events into terminal escape sequences.\n\n @ingroup mouse"]
2348pub type GhosttyMouseEncoder_ptr = *mut GhosttyMouseEncoder;
2349#[doc = " Mouse reporting disabled."]
2350pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_NONE: GhosttyMouseTrackingMode = 0;
2351#[doc = " X10 mouse mode."]
2352pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_X10: GhosttyMouseTrackingMode = 1;
2353#[doc = " Normal mouse mode (button press/release only)."]
2354pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_NORMAL: GhosttyMouseTrackingMode = 2;
2355#[doc = " Button-event tracking mode."]
2356pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_BUTTON: GhosttyMouseTrackingMode = 3;
2357#[doc = " Any-event tracking mode."]
2358pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_ANY: GhosttyMouseTrackingMode = 4;
2359#[doc = " Mouse tracking mode.\n\n @ingroup mouse"]
2360pub type GhosttyMouseTrackingMode = ::std::os::raw::c_uint;
2361pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_X10: GhosttyMouseFormat = 0;
2362pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_UTF8: GhosttyMouseFormat = 1;
2363pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_SGR: GhosttyMouseFormat = 2;
2364pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_URXVT: GhosttyMouseFormat = 3;
2365pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_SGR_PIXELS: GhosttyMouseFormat = 4;
2366#[doc = " Mouse output format.\n\n @ingroup mouse"]
2367pub type GhosttyMouseFormat = ::std::os::raw::c_uint;
2368#[doc = " Mouse encoder size and geometry context.\n\n This describes the rendered terminal geometry used to convert\n surface-space positions into encoded coordinates.\n\n @ingroup mouse"]
2369#[repr(C)]
2370#[derive(Debug, Default, Copy, Clone)]
2371pub struct GhosttyMouseEncoderSize {
2372    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyMouseEncoderSize)."]
2373    pub size: usize,
2374    #[doc = " Full screen width in pixels."]
2375    pub screen_width: u32,
2376    #[doc = " Full screen height in pixels."]
2377    pub screen_height: u32,
2378    #[doc = " Cell width in pixels. Must be non-zero."]
2379    pub cell_width: u32,
2380    #[doc = " Cell height in pixels. Must be non-zero."]
2381    pub cell_height: u32,
2382    #[doc = " Top padding in pixels."]
2383    pub padding_top: u32,
2384    #[doc = " Bottom padding in pixels."]
2385    pub padding_bottom: u32,
2386    #[doc = " Right padding in pixels."]
2387    pub padding_right: u32,
2388    #[doc = " Left padding in pixels."]
2389    pub padding_left: u32,
2390}
2391#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2392const _: () = {
2393    ["Size of GhosttyMouseEncoderSize"][::std::mem::size_of::<GhosttyMouseEncoderSize>() - 40usize];
2394    ["Alignment of GhosttyMouseEncoderSize"]
2395        [::std::mem::align_of::<GhosttyMouseEncoderSize>() - 8usize];
2396    ["Offset of field: GhosttyMouseEncoderSize::size"]
2397        [::std::mem::offset_of!(GhosttyMouseEncoderSize, size) - 0usize];
2398    ["Offset of field: GhosttyMouseEncoderSize::screen_width"]
2399        [::std::mem::offset_of!(GhosttyMouseEncoderSize, screen_width) - 8usize];
2400    ["Offset of field: GhosttyMouseEncoderSize::screen_height"]
2401        [::std::mem::offset_of!(GhosttyMouseEncoderSize, screen_height) - 12usize];
2402    ["Offset of field: GhosttyMouseEncoderSize::cell_width"]
2403        [::std::mem::offset_of!(GhosttyMouseEncoderSize, cell_width) - 16usize];
2404    ["Offset of field: GhosttyMouseEncoderSize::cell_height"]
2405        [::std::mem::offset_of!(GhosttyMouseEncoderSize, cell_height) - 20usize];
2406    ["Offset of field: GhosttyMouseEncoderSize::padding_top"]
2407        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_top) - 24usize];
2408    ["Offset of field: GhosttyMouseEncoderSize::padding_bottom"]
2409        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_bottom) - 28usize];
2410    ["Offset of field: GhosttyMouseEncoderSize::padding_right"]
2411        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_right) - 32usize];
2412    ["Offset of field: GhosttyMouseEncoderSize::padding_left"]
2413        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_left) - 36usize];
2414};
2415#[doc = " Mouse tracking mode (value: GhosttyMouseTrackingMode)."]
2416pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_EVENT: GhosttyMouseEncoderOption = 0;
2417#[doc = " Mouse output format (value: GhosttyMouseFormat)."]
2418pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_FORMAT: GhosttyMouseEncoderOption = 1;
2419#[doc = " Renderer size context (value: GhosttyMouseEncoderSize)."]
2420pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_SIZE: GhosttyMouseEncoderOption = 2;
2421#[doc = " Whether any mouse button is currently pressed (value: bool)."]
2422pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_ANY_BUTTON_PRESSED:
2423    GhosttyMouseEncoderOption = 3;
2424#[doc = " Whether to enable motion deduplication by last cell (value: bool)."]
2425pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_TRACK_LAST_CELL:
2426    GhosttyMouseEncoderOption = 4;
2427#[doc = " Mouse encoder option identifiers.\n\n These values are used with ghostty_mouse_encoder_setopt() to configure\n the behavior of the mouse encoder.\n\n @ingroup mouse"]
2428pub type GhosttyMouseEncoderOption = ::std::os::raw::c_uint;
2429unsafe extern "C" {
2430    #[doc = " Create a new mouse encoder instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param encoder Pointer to store the created encoder handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup mouse"]
2431    pub fn ghostty_mouse_encoder_new(
2432        allocator: *const GhosttyAllocator,
2433        encoder: *mut GhosttyMouseEncoder_ptr,
2434    ) -> GhosttyResult;
2435}
2436unsafe extern "C" {
2437    #[doc = " Free a mouse encoder instance.\n\n @param encoder The encoder handle to free (may be NULL)\n\n @ingroup mouse"]
2438    pub fn ghostty_mouse_encoder_free(encoder: GhosttyMouseEncoder_ptr);
2439}
2440unsafe extern "C" {
2441    #[doc = " Set an option on the mouse encoder.\n\n A null pointer value does nothing. It does not reset to defaults.\n\n @param encoder The encoder handle, must not be NULL\n @param option The option to set\n @param value Pointer to option value (type depends on option)\n\n @ingroup mouse"]
2442    pub fn ghostty_mouse_encoder_setopt(
2443        encoder: GhosttyMouseEncoder_ptr,
2444        option: GhosttyMouseEncoderOption,
2445        value: *const ::std::os::raw::c_void,
2446    );
2447}
2448unsafe extern "C" {
2449    #[doc = " Set encoder options from a terminal's current state.\n\n This sets tracking mode and output format from terminal state.\n It does not modify size or any-button state.\n\n @param encoder The encoder handle, must not be NULL\n @param terminal The terminal handle, must not be NULL\n\n @ingroup mouse"]
2450    pub fn ghostty_mouse_encoder_setopt_from_terminal(
2451        encoder: GhosttyMouseEncoder_ptr,
2452        terminal: GhosttyTerminal_ptr,
2453    );
2454}
2455unsafe extern "C" {
2456    #[doc = " Reset internal encoder state.\n\n This clears motion deduplication state (last tracked cell).\n\n @param encoder The encoder handle (may be NULL)\n\n @ingroup mouse"]
2457    pub fn ghostty_mouse_encoder_reset(encoder: GhosttyMouseEncoder_ptr);
2458}
2459unsafe extern "C" {
2460    #[doc = " Encode a mouse event into a terminal escape sequence.\n\n Not all mouse events produce output. In such cases this returns\n GHOSTTY_SUCCESS with out_len set to 0.\n\n If the output buffer is too small, this returns GHOSTTY_OUT_OF_SPACE\n and out_len contains the required size.\n\n @param encoder The encoder handle, must not be NULL\n @param event The mouse event to encode, must not be NULL\n @param out_buf Buffer to write encoded bytes to, or NULL to query required size\n @param out_buf_size Size of out_buf in bytes\n @param out_len Pointer to store bytes written (or required bytes on failure)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if buffer is too small,\n         or another error code\n\n @ingroup mouse"]
2461    pub fn ghostty_mouse_encoder_encode(
2462        encoder: GhosttyMouseEncoder_ptr,
2463        event: GhosttyMouseEvent_ptr,
2464        out_buf: *mut ::std::os::raw::c_char,
2465        out_buf_size: usize,
2466        out_len: *mut usize,
2467    ) -> GhosttyResult;
2468}
2469unsafe extern "C" {
2470    #[doc = " Check if paste data is safe to paste into the terminal.\n\n Data is considered unsafe if it contains:\n - Newlines (`\\n`) which can inject commands\n - The bracketed paste end sequence (`\\x1b[201~`) which can be used\n   to exit bracketed paste mode and inject commands\n\n This check is conservative and considers data unsafe regardless of\n current terminal state.\n\n @param data The paste data to check (must not be NULL)\n @param len The length of the data in bytes\n @return true if the data is safe to paste, false otherwise"]
2471    pub fn ghostty_paste_is_safe(data: *const ::std::os::raw::c_char, len: usize) -> bool;
2472}