Visual Studio Code, rebuilt in Rust
Rust
refactor(terminal): build ghostty_vt on the libghostty-rs bindings
rokartur5b4e4b6797aa
diff --git a/native/.cargo/config.toml b/native/.cargo/config.tomlnew file mode 100644index 00000000000..3e700beb1f2--- /dev/null+++ b/native/.cargo/config.toml@@ -0,0 +1,3 @@+[env]+# libghostty-vt-sys builds Ghostty in Zig Debug whenever cargo's DEBUG is true (release has debug = "limited"): page integrity checks make it ~15x slower.+LIBGHOSTTY_VT_SYS_OPTIMIZE = "ReleaseFast"diff --git a/native/Cargo.lock b/native/Cargo.lockindex a41b178809b..359642b878e 100644--- a/native/Cargo.lock+++ b/native/Cargo.lock@@ -2364,7 +2364,7 @@ dependencies = [name = "ghostty_vt"version = "0.1.0"dependencies = [- "sha2",+ "libghostty-vt",][[package]]@@ -3377,6 +3377,18 @@ dependencies = ["generic-array",]+[[package]]+name = "int-enum"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "98e2fe9fba0e74e6b4cbc96a06d473ee6f2dd675f4b26ef6391a4973060c7ed1"+dependencies = [+ "proc-macro2",+ "proc-macro2-diagnostics",+ "quote",+ "syn 3.0.10",+]+[[package]]name = "interpolate_name"version = "0.2.4"@@ -3658,6 +3670,21 @@ dependencies = ["cc",]+[[package]]+name = "libghostty-vt"+version = "0.2.1"+source = "git+https://github.com/rokartur/libghostty-rs?rev=10df3e1850e4cad560cfd3e0a9a58e3f7e4a0557#10df3e1850e4cad560cfd3e0a9a58e3f7e4a0557"+dependencies = [+ "bitflags 2.13.2",+ "int-enum",+ "libghostty-vt-sys",+]++[[package]]+name = "libghostty-vt-sys"+version = "0.2.1"+source = "git+https://github.com/rokartur/libghostty-rs?rev=10df3e1850e4cad560cfd3e0a9a58e3f7e4a0557#10df3e1850e4cad560cfd3e0a9a58e3f7e4a0557"+[[package]]name = "libloading"version = "0.8.9"@@ -5026,6 +5053,17 @@ dependencies = ["unicode-ident",]+[[package]]+name = "proc-macro2-diagnostics"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df921e1ef974ebc8dd9effdb0c037a96928ae8cbf871438e02d6fd67204b595e"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.10",+]+[[package]]name = "profiling"version = "1.0.18"diff --git a/native/crates/app/src/workbench/terminal_view/grid.rs b/native/crates/app/src/workbench/terminal_view/grid.rsindex 094827b4286..11974ca06d8 100644--- a/native/crates/app/src/workbench/terminal_view/grid.rs+++ b/native/crates/app/src/workbench/terminal_view/grid.rs@@ -149,12 +149,10 @@ pub fn paint(bounds: Bounds<Pixels>, instance: &TerminalInstance, look: &Look, wlet (top, bottom) = (-offset, rows as i32 - 1 - offset);let visible_matches: Vec<(usize, &crate::terminal::search::Match)> = look.find_matches.iter().enumerate().filter(|(_, found)| found.end().line.0 >= top && found.start().line.0 <= bottom).collect();- for (row, column, line_cells) in (0..rows).flat_map(|row| {- let line_cells = std::rc::Rc::new(term.row(Line(row as i32 - offset)));- (0..cols).map(move |column| (row, column, line_cells.clone()))- }) {+ let viewport = term.viewport_rows();+ for (row, column) in (0..rows).flat_map(|row| (0..cols).map(move |column| (row, column))) {let point = Point::new(Line(row as i32 - offset), Column(column));- let content = &line_cells[Column(column)];+ let content = &viewport[row][Column(column)];let flags = content.flags;if flags.intersects(Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER) {continue;diff --git a/native/crates/ghostty_vt/Cargo.toml b/native/crates/ghostty_vt/Cargo.tomlindex cdffad1cfe5..790655f60aa 100644--- a/native/crates/ghostty_vt/Cargo.toml+++ b/native/crates/ghostty_vt/Cargo.toml@@ -3,8 +3,8 @@ name = "ghostty_vt"version = "0.1.0"edition.workspace = truelicense.workspace = true-build = "build.rs"-links = "ghostty-vt"-[build-dependencies]-sha2 = "0.10"+[dependencies]+# Fork of uzaaft/libghostty-rs d3a306c (Ghostty vt-1.0.2, 573c4a21; crates.io 0.2.2 builds a887df42, 2333 commits older)+# whose build.rs adds the VS16 patch, the Windows MSVC cross build and ntdll: port/notes.md.+libghostty-vt = { git = "https://github.com/rokartur/libghostty-rs", rev = "10df3e1850e4cad560cfd3e0a9a58e3f7e4a0557", default-features = false }diff --git a/native/crates/ghostty_vt/NOTICES.txt b/native/crates/ghostty_vt/NOTICES.txtindex 74e6ccf39df..61aa5f31f3c 100644--- a/native/crates/ghostty_vt/NOTICES.txt+++ b/native/crates/ghostty_vt/NOTICES.txt@@ -209,3 +209,29 @@ authorization of the copyright holder.---------------------------------------------------------+libghostty-vt and libghostty-vt-sys (Rust bindings) 0.2.1, rev d3a306c+https://github.com/uzaaft/libghostty-rs++MIT License++Copyright (c) 2026 Uzair Aftab, Leah Amelia Chen++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++---------------------------------------------------------diff --git a/native/crates/ghostty_vt/build.rs b/native/crates/ghostty_vt/build.rsdeleted file mode 100644index 9a44d4ab254..00000000000--- a/native/crates/ghostty_vt/build.rs+++ /dev/null@@ -1,95 +0,0 @@-//! Builds libghostty-vt from its pinned release with Zig, or links a prebuilt one from `GHOSTTY_VT_LIB_DIR`.--use std::path::{Path, PathBuf};-use std::process::Command;--use sha2::{Digest, Sha256};--const VERSION: &str = "1.0.2";-const SOURCE_SHA256: &str = "1dcafa8a3357f3a6bbf4f2696e61de611400c5469518716793dfffd35f008b3e";-const DEPS_SHA256: &str = "c56156dbea82fdf71f13bf0d704cdf4393b6a04208d7f9691e0d7f60c7f9ca4d";--fn main() {- println!("cargo:rerun-if-changed=build.rs");- println!("cargo:rerun-if-env-changed=GHOSTTY_VT_LIB_DIR");- println!("cargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET");- let target = std::env::var("TARGET").unwrap();- let lib_dir = match std::env::var_os("GHOSTTY_VT_LIB_DIR") {- Some(dir) => PathBuf::from(dir),- None => build(&target),- };- println!("cargo:rustc-link-search=native={}", lib_dir.display());- // Zig names the Windows static archive apart from the DLL's import library.- let name = if target.contains("windows") { "ghostty-vt-static" } else { "ghostty-vt" };- println!("cargo:rustc-link-lib=static={name}");- if target.contains("windows") {- println!("cargo:rustc-link-lib=dylib=ntdll");- }-}--fn build(target: &str) -> PathBuf {- let out = PathBuf::from(std::env::var("OUT_DIR").unwrap());- let prefix = out.join("install");- let source = fetch(&out, &format!("libghostty-vt-{VERSION}.tar.gz"), SOURCE_SHA256);- keep_variation_selectors_after_modifier_bases(&source);- let deps = fetch(&out, &format!("libghostty-vt-{VERSION}-deps.tar.gz"), DEPS_SHA256);- let status = Command::new("zig")- .current_dir(&source)- .args(["build", "-Doptimize=ReleaseFast", "-Dcpu=baseline"])- .arg(format!("-Dtarget={}", zig_target(target)))- .arg("--system")- .arg(&deps)- .arg("--prefix")- .arg(&prefix)- .arg("--cache-dir")- .arg(out.join("zig-cache"))- .status()- .unwrap_or_else(|error| panic!("zig 0.17 builds libghostty-vt and must be on PATH: {error}"));- assert!(status.success(), "zig build of libghostty-vt {VERSION} failed");- prefix.join("lib")-}--/// Downloads a release tarball, checks it against its SHA256SUMS entry and unpacks it into `out`.-fn fetch(out: &Path, file: &str, sha256: &str) -> PathBuf {- let tarball = out.join(file);- let url = format!("https://release.files.ghostty.org/libghostty-vt/{VERSION}/{file}");- let status = Command::new("curl").args(["-sSfL", "--retry", "3", "-o"]).arg(&tarball).arg(&url).status().expect("curl downloads libghostty-vt");- assert!(status.success(), "downloading {url} failed");- let digest = Sha256::digest(std::fs::read(&tarball).unwrap());- let hex: String = digest.iter().map(|byte| format!("{byte:02x}")).collect();- assert_eq!(hex, sha256, "{file} does not match its pinned SHA-256");- let status = Command::new("tar").arg("-xzf").arg(&tarball).arg("-C").arg(out).status().expect("tar unpacks libghostty-vt");- assert!(status.success(), "unpacking {file} failed");- out.join(file.trim_end_matches(".tar.gz"))-}--/// Ghostty 1.0.2 drops VS16 after an emoji modifier base (U+270C, U+1F44D) outside mode 2027, as uucode gives-/// those `emoji_modifier_base` rather than `extended_pictographic`; xterm.js keeps it, so copied text keeps it.-fn keep_variation_selectors_after_modifier_bases(source: &Path) {- let file = source.join("src/terminal/Terminal.zig");- let zig = std::fs::read_to_string(&file).unwrap();- let check = "const emoji = prev_props.grapheme_break == .extended_pictographic;";- assert_eq!(zig.matches(check).count(), 1, "Terminal.zig changed: revisit the VS16 patch");- let fixed = "const emoji = prev_props.grapheme_break == .extended_pictographic or prev_props.grapheme_break == .emoji_modifier_base;";- std::fs::write(&file, zig.replace(check, fixed)).unwrap();-}--/// Zig 0.17 cannot compile the bundled C++ (simdutf, highway) against cargo-xwin's MSVC SDK, so an MSVC cross-/// build links the GNU target's archive: lld-link takes it, Microsoft link.exe rejects its COMDATs (LNK1143).-fn zig_target(target: &str) -> String {- let arch = target.split('-').next().unwrap();- if target.ends_with("apple-darwin") {- let deployment = std::env::var("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|_| "12.0".into());- return format!("{arch}-macos.{deployment}");- }- if target.ends_with("linux-gnu") {- return format!("{arch}-linux-gnu");- }- if target.ends_with("windows-msvc") && cfg!(windows) {- return format!("{arch}-windows-msvc");- }- if target.contains("windows") {- return format!("{arch}-windows-gnu");- }- panic!("no libghostty-vt build for {target}");-}diff --git a/native/crates/ghostty_vt/src/lib.rs b/native/crates/ghostty_vt/src/lib.rsindex 783df146547..df3a18ddb55 100644--- a/native/crates/ghostty_vt/src/lib.rs+++ b/native/crates/ghostty_vt/src/lib.rs@@ -1,15 +1,24 @@-//! libghostty-vt behind safe types: the terminal screen the integrated terminal draws, in the shape the port-//! used from alacritty_terminal (lines relative to the active area's top, negative into the scrollback).-//! Every `unsafe` of the crate is in this file, each one a call into the C API with the pointers it documents.+//! libghostty-vt, through the libghostty-vt crate's safe bindings, as the terminal screen the integrated terminal+//! draws, in the shape the port used from alacritty_terminal (lines relative to the active area's top, negative into+//! the scrollback). The crate has no `unsafe`.mod selection;-#[allow(clippy::all)]-mod sys;-use std::ffi::c_void;+use std::cell::RefCell;use std::ops::{Add, AddAssign, Index, Sub, SubAssign};-use std::ptr;+use libghostty_vt::effect::{self, ConformanceLevel, DeviceAttributeFeature, DeviceAttributes, DeviceType, PrimaryDeviceAttributes, SecondaryDeviceAttributes, TertiaryDeviceAttributes};+use libghostty_vt::grid_ref::{GridRef, TrackedGridRef};+use libghostty_vt::mode::{Kind, Mode};+use libghostty_vt::point::{Coordinate, Point as GhosttyPoint, Space};+use libghostty_vt::render::{CellIterator, RowIterator};+use libghostty_vt::report::SizeReportSize;+use libghostty_vt::screen::{self, CellContentTag, CellWide, Screen, cell};+use libghostty_vt::style::{Style, StyleColor, Underline};+use libghostty_vt::terminal::{CursorStyle as GhosttyCursorStyle, ScrollViewport};+use libghostty_vt::{RenderState, Terminal};++pub use libghostty_vt::color::Rgb;pub use selection::{SelectionRange, SelectionType};#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]@@ -89,13 +98,6 @@ pub enum Side {Right,}-#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]-pub struct Rgb {- pub r: u8,- pub g: u8,- pub b: u8,-}-/// A cell's color as SGR set it: the default foreground or background, a palette index or a true color.#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]pub enum Color {@@ -209,6 +211,7 @@ impl Cell {}/// A line's cells, read from the terminal at one moment.+#[derive(Debug, PartialEq)]pub struct Row(Vec<Cell>);impl Row {@@ -360,78 +363,96 @@ pub struct Effects {pub title: Option<String>,}-/// The callbacks' state, boxed so its address stays the userdata the terminal holds.-struct Callbacks {+/// The effect callbacks' state, the userdata the terminal hands them.+struct Handler {effects: Effects,- size: sys::GhosttySizeReportSize,+ size: SizeReportSize,}-/// xterm.js 6.1's replies (`CSI c`, `CSI > c`, `CSI > q`), the ones VS Code's terminal gives.-const XTVERSION: &str = "xterm.js(6.1.0-beta.337)";+impl effect::OnPtyWrite for Handler {+ fn on_pty_write<'t>(&mut self, _: &'t Terminal<'_>, data: &'t [u8]) {+ self.effects.pty_write.extend_from_slice(data);+ }+}-pub struct Term {- raw: sys::GhosttyTerminal,- render: sys::GhosttyRenderState,- callbacks: Box<Callbacks>,- config: Config,- default_colors: Option<DefaultColors>,- selection: Option<selection::Selection>,+impl effect::OnBell for Handler {+ fn on_bell(&mut self, _: &Terminal<'_>) {+ self.effects.bell = true;+ }}-impl Drop for Term {- fn drop(&mut self) {- self.selection = None;- // SAFETY: both were created in `new` and are freed once, the terminal last as the selection's refs need it.- unsafe {- sys::ghostty_render_state_free(self.render);- sys::ghostty_terminal_free(self.raw);+impl effect::OnTitleChanged for Handler {+ fn on_title_changed(&mut self, terminal: &Terminal<'_>) {+ // A panic here would unwind into Zig, so a failed read leaves the title as it was.+ if let Ok(title) = terminal.title() {+ self.effects.title = Some(String::from_utf8_lossy(title).into_owned());}}}-fn check(result: sys::GhosttyResult, call: &str) {- assert!(result == sys::GHOSTTY_SUCCESS, "{call} failed: {result}");+impl effect::OnSize for Handler {+ fn on_size(&mut self, _: &Terminal<'_>) -> Option<SizeReportSize> {+ Some(self.size)+ }+}++/// xterm.js `CSI c` (`?1;2c`) and `CSI > c` (`>0;276;0c`).+impl effect::OnDeviceAttributes for Handler {+ fn on_device_attributes(&mut self, _: &Terminal<'_>) -> Option<DeviceAttributes> {+ Some(DeviceAttributes {+ primary: PrimaryDeviceAttributes::new(ConformanceLevel(1), &[DeviceAttributeFeature(2)]),+ secondary: SecondaryDeviceAttributes { device_type: DeviceType(0), firmware_version: 276, rom_cartridge: 0 },+ tertiary: TertiaryDeviceAttributes { unit_id: 0 },+ })+ }+}++impl effect::OnXtversion for Handler {+ fn on_xtversion<'t>(&mut self, _: &'t Terminal<'_>) -> Option<&'t [u8]> {+ Some(XTVERSION.as_bytes())+ }+}++/// xterm.js 6.1's replies (`CSI c`, `CSI > c`, `CSI > q`), the ones VS Code's terminal gives.+const XTVERSION: &str = "xterm.js(6.1.0-beta.337)";++/// The viewport copy the paint path and the cursor style read, with the iterators reused across frames.+struct Render {+ state: RenderState<'static>,+ rows: RowIterator<'static>,+ cells: CellIterator<'static>,+}++pub struct Term {+ selection: Option<selection::Selection>,+ render: RefCell<Render>,+ raw: Terminal<'static>,+ config: Config,+ default_colors: Option<DefaultColors>,}impl Term {pub fn new(cols: u16, rows: u16, config: Config) -> Term {- let mut raw = ptr::null_mut();- let mut render = ptr::null_mut();- // SAFETY: a null allocator is the library's default; the out pointers are valid locals.- unsafe {- check(sys::ghostty_terminal_new(ptr::null(), &mut raw, cols.max(1), rows.max(1)), "ghostty_terminal_new");- check(sys::ghostty_render_state_new(ptr::null(), &mut render), "ghostty_render_state_new");- }- let size = sys::GhosttySizeReportSize { rows, columns: cols, cell_width: 0, cell_height: 0 };- let mut term = Term { raw, render, callbacks: Box::new(Callbacks { effects: Effects::default(), size }), config: Config::default(), default_colors: None, selection: None };- term.install_callbacks();- let unlimited = usize::MAX;- term.set(sys::GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES, &unlimited as *const usize as *const c_void);+ let mut raw = Terminal::new(cols.max(1), rows.max(1)).unwrap();+ let size = SizeReportSize { rows, columns: cols, cell_width: 0, cell_height: 0 };+ raw.register_effects(Handler { effects: Effects::default(), size })+ .and_then(|effects| effects.with_on_pty_write())+ .and_then(|effects| effects.with_on_bell())+ .and_then(|effects| effects.with_on_title_changed())+ .and_then(|effects| effects.with_on_size())+ .and_then(|effects| effects.with_on_device_attributes())+ .and_then(|effects| effects.with_on_xtversion())+ .unwrap();+ raw.set_scrollback_max_bytes(Some(usize::MAX)).unwrap();+ let render = Render { state: RenderState::new().unwrap(), rows: RowIterator::new().unwrap(), cells: CellIterator::new().unwrap() };+ let mut term = Term { selection: None, render: RefCell::new(render), raw, config: Config::default(), default_colors: None };term.apply_config(&config);term.config = config;term}- fn set(&mut self, option: sys::GhosttyTerminalOption, value: *const c_void) {- // SAFETY: each caller passes the input type `terminal.h` documents for `option`, valid for the call.- check(unsafe { sys::ghostty_terminal_set(self.raw, option, value) }, "ghostty_terminal_set");- }-- fn install_callbacks(&mut self) {- let userdata: *mut Callbacks = &mut *self.callbacks;- self.set(sys::GHOSTTY_TERMINAL_OPT_USERDATA, userdata as *const c_void);- let write_pty: unsafe extern "C" fn(sys::GhosttyTerminal, *mut c_void, *const u8, usize) = write_pty;- let bell: unsafe extern "C" fn(sys::GhosttyTerminal, *mut c_void) = bell;- let title: unsafe extern "C" fn(sys::GhosttyTerminal, *mut c_void) = title_changed;- let size: unsafe extern "C" fn(sys::GhosttyTerminal, *mut c_void, *mut sys::GhosttySizeReportSize) -> bool = size;- let attributes: unsafe extern "C" fn(sys::GhosttyTerminal, *mut c_void, *mut sys::GhosttyDeviceAttributes) -> bool = device_attributes;- let xtversion: unsafe extern "C" fn(sys::GhosttyTerminal, *mut c_void) -> sys::GhosttyString = xtversion;- self.set(sys::GHOSTTY_TERMINAL_OPT_WRITE_PTY, write_pty as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_BELL, bell as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_TITLE_CHANGED, title as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_SIZE, size as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES, attributes as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_XTVERSION, xtversion as *const c_void);+ fn handler(&mut self) -> &mut Handler {+ self.raw.effect_handler_mut::<Handler>().unwrap()}/// Applies changed options: the scrollback limit, the word separators and the default cursor.@@ -444,17 +465,15 @@ impl Term {fn apply_config(&mut self, config: &Config) {// Ghostty prunes whole pages, so it keeps more lines than this; `history_size` hides the rest.- let lines = config.scrolling_history;- self.set(sys::GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_LINES, &lines as *const usize as *const c_void);+ self.raw.set_scrollback_max_lines(Some(config.scrolling_history)).unwrap();let style = match config.default_cursor_style.shape {- CursorShape::Beam => sys::GHOSTTY_CURSOR_STYLE_BAR,- CursorShape::Underline => sys::GHOSTTY_CURSOR_STYLE_UNDERLINE,- CursorShape::HollowBlock => sys::GHOSTTY_CURSOR_STYLE_BLOCK_HOLLOW,- CursorShape::Block | CursorShape::Hidden => sys::GHOSTTY_CURSOR_STYLE_BLOCK,+ CursorShape::Beam => GhosttyCursorStyle::Bar,+ CursorShape::Underline => GhosttyCursorStyle::Underline,+ CursorShape::HollowBlock => GhosttyCursorStyle::BlockHollow,+ CursorShape::Block | CursorShape::Hidden => GhosttyCursorStyle::Block,};- let blink = config.default_cursor_style.blinking;- self.set(sys::GHOSTTY_TERMINAL_OPT_DEFAULT_CURSOR_STYLE, &style as *const _ as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_DEFAULT_CURSOR_BLINK, &blink as *const bool as *const c_void);+ self.raw.set_default_cursor_style(Some(style)).unwrap();+ self.raw.set_default_cursor_blink(Some(config.default_cursor_style.blinking)).unwrap();}pub fn semantic_escape_chars(&self) -> &str {@@ -466,39 +485,32 @@ impl Term {if self.default_colors.as_ref() == Some(&colors) {return;}- let rgb = |color: Rgb| sys::GhosttyColorRgb { r: color.r, g: color.g, b: color.b };- let palette: Vec<sys::GhosttyColorRgb> = colors.palette.iter().map(|&color| rgb(color)).collect();- let (foreground, background, cursor) = (rgb(colors.foreground), rgb(colors.background), rgb(colors.cursor));- self.set(sys::GHOSTTY_TERMINAL_OPT_COLOR_PALETTE, palette.as_ptr() as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_COLOR_FOREGROUND, &foreground as *const _ as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_COLOR_BACKGROUND, &background as *const _ as *const c_void);- self.set(sys::GHOSTTY_TERMINAL_OPT_COLOR_CURSOR, &cursor as *const _ as *const c_void);+ self.raw.set_default_color_palette(Some(libghostty_vt::color::Palette(colors.palette))).unwrap();+ self.raw.set_default_fg_color(Some(colors.foreground)).unwrap();+ self.raw.set_default_bg_color(Some(colors.background)).unwrap();+ self.raw.set_default_cursor_color(Some(colors.cursor)).unwrap();self.default_colors = Some(colors);}/// The colors OSC 4, 10, 11 and 12 changed from the defaults `set_default_colors` gave.pub fn color_overrides(&self) -> ColorOverrides {let mut overrides = vec![None; 259];- let mut palette = [sys::GhosttyColorRgb::default(); 256];- let mut defaults = [sys::GhosttyColorRgb::default(); 256];- self.get(sys::GHOSTTY_TERMINAL_DATA_COLOR_PALETTE, &mut palette);- self.get(sys::GHOSTTY_TERMINAL_DATA_COLOR_PALETTE_DEFAULT, &mut defaults);- let rgb = |color: sys::GhosttyColorRgb| Rgb { r: color.r, g: color.g, b: color.b };- let same = |a: sys::GhosttyColorRgb, b: sys::GhosttyColorRgb| (a.r, a.g, a.b) == (b.r, b.g, b.b);+ let (palette, defaults) = (self.raw.color_palette().unwrap(), self.raw.default_color_palette().unwrap());for index in 0..256 {- if !same(palette[index], defaults[index]) {- overrides[index] = Some(rgb(palette[index]));+ if palette.0[index] != defaults.0[index] {+ overrides[index] = Some(palette.0[index]);}}let pairs = [- (sys::GHOSTTY_TERMINAL_DATA_COLOR_FOREGROUND, sys::GHOSTTY_TERMINAL_DATA_COLOR_FOREGROUND_DEFAULT),- (sys::GHOSTTY_TERMINAL_DATA_COLOR_BACKGROUND, sys::GHOSTTY_TERMINAL_DATA_COLOR_BACKGROUND_DEFAULT),- (sys::GHOSTTY_TERMINAL_DATA_COLOR_CURSOR, sys::GHOSTTY_TERMINAL_DATA_COLOR_CURSOR_DEFAULT),+ (self.raw.fg_color(), self.raw.default_fg_color()),+ (self.raw.bg_color(), self.raw.default_bg_color()),+ (self.raw.cursor_color(), self.raw.default_cursor_color()),];for (offset, (current, default)) in pairs.into_iter().enumerate() {- let (mut value, mut fallback) = (sys::GhosttyColorRgb::default(), sys::GhosttyColorRgb::default());- if self.try_get(current, &mut value) && (!self.try_get(default, &mut fallback) || !same(value, fallback)) {- overrides[256 + offset] = Some(rgb(value));+ if let Some(value) = current.unwrap()+ && default.unwrap() != Some(value)+ {+ overrides[256 + offset] = Some(value);}}ColorOverrides(overrides)@@ -507,71 +519,52 @@ impl Term {/// Parses the program's output.pub fn advance(&mut self, bytes: &[u8]) {let screen = self.active_screen();- // SAFETY: `bytes` is valid for its length; the callbacks write into `self.callbacks`, which outlives the call.- unsafe { sys::ghostty_terminal_vt_write(self.raw, bytes.as_ptr(), bytes.len()) };+ self.raw.vt_write(bytes);// xterm.js clears the selection when the other buffer activates.if self.active_screen() != screen {self.selection = None;}}- fn active_screen(&self) -> sys::GhosttyTerminalScreen {- let mut screen: sys::GhosttyTerminalScreen = 0;- self.get(sys::GHOSTTY_TERMINAL_DATA_ACTIVE_SCREEN, &mut screen);- screen+ fn active_screen(&self) -> Screen {+ self.raw.active_screen().unwrap()}pub fn take_effects(&mut self) -> Effects {- std::mem::take(&mut self.callbacks.effects)+ std::mem::take(&mut self.handler().effects)}/// RIS: the screens, modes and colors back to their defaults.pub fn reset(&mut self) {- // SAFETY: `raw` is a live terminal.- unsafe { sys::ghostty_terminal_reset(self.raw) };+ self.raw.reset();}pub fn resize(&mut self, cols: u16, rows: u16) {self.selection = None;- let size = &self.callbacks.size;- let (width, height) = (size.cell_width, size.cell_height);- // SAFETY: `raw` is a live terminal.- check(unsafe { sys::ghostty_terminal_resize(self.raw, cols.max(1), rows.max(1), width, height) }, "ghostty_terminal_resize");- self.callbacks.size.rows = rows;- self.callbacks.size.columns = cols;+ let size = self.handler().size;+ self.raw.resize(cols.max(1), rows.max(1), size.cell_width, size.cell_height).unwrap();+ let size = &mut self.handler().size;+ size.rows = rows;+ size.columns = cols;}/// The cell size in pixels, for `CSI 14 t` and `CSI 16 t`.pub fn set_cell_size(&mut self, width: u32, height: u32) {- self.callbacks.size.cell_width = width;- self.callbacks.size.cell_height = height;- }-- fn get<T>(&self, data: sys::GhosttyTerminalData, out: &mut T) {- assert!(self.try_get(data, out), "ghostty_terminal_get({data}) failed");- }-- fn try_get<T>(&self, data: sys::GhosttyTerminalData, out: &mut T) -> bool {- // SAFETY: each caller passes the output type `terminal.h` documents for `data`.- unsafe { sys::ghostty_terminal_get(self.raw, data, out as *mut T as *mut c_void) == sys::GHOSTTY_SUCCESS }+ let size = &mut self.handler().size;+ size.cell_width = width;+ size.cell_height = height;}pub fn columns(&self) -> usize {- let mut cols = 0u16;- self.get(sys::GHOSTTY_TERMINAL_DATA_COLS, &mut cols);- cols as usize+ self.raw.cols().unwrap() as usize}pub fn screen_lines(&self) -> usize {- let mut rows = 0u16;- self.get(sys::GHOSTTY_TERMINAL_DATA_ROWS, &mut rows);- rows as usize+ self.raw.rows().unwrap() as usize}fn scrollback_rows(&self) -> usize {- let mut rows = 0usize;- self.get(sys::GHOSTTY_TERMINAL_DATA_SCROLLBACK_ROWS, &mut rows);- rows+ self.raw.scrollback_rows().unwrap()}/// The scrollback's lines, at most `scrolling_history` as xterm.js's `scrollback`.@@ -611,50 +604,38 @@ impl Term {];let mut mode = TermMode::default();for (number, flag) in modes {- let mut config = sys::GhosttyTerminalModeConfig { mode: number, value: false };- self.get(sys::GHOSTTY_TERMINAL_DATA_MODE, &mut config);- if config.value {+ if self.raw.mode(Mode::new(number, Kind::Dec)).unwrap() {mode = mode | flag;}}- if self.active_screen() == sys::GHOSTTY_TERMINAL_SCREEN_ALTERNATE {+ if self.active_screen() == Screen::Alternate {mode = mode | TermMode::ALT_SCREEN;}mode}pub fn cursor(&self) -> Cursor {- let (mut x, mut y, mut pending_wrap) = (0u16, 0u16, false);- self.get(sys::GHOSTTY_TERMINAL_DATA_CURSOR_X, &mut x);- self.get(sys::GHOSTTY_TERMINAL_DATA_CURSOR_Y, &mut y);- self.get(sys::GHOSTTY_TERMINAL_DATA_CURSOR_PENDING_WRAP, &mut pending_wrap);- Cursor { point: Point::new(Line(y as i32), Column(x as usize)), input_needs_wrap: pending_wrap }+ let (x, y) = (self.raw.cursor_x().unwrap(), self.raw.cursor_y().unwrap());+ Cursor { point: Point::new(Line(y as i32), Column(x as usize)), input_needs_wrap: self.raw.is_cursor_pending_wrap().unwrap() }}/// The pen the next printed character takes (SGR state), as a blank cell.pub fn cursor_template(&self) -> Cell {- let mut style = sys::GhosttyStyle::default();- self.get(sys::GHOSTTY_TERMINAL_DATA_CURSOR_SGR_STYLE, &mut style);let mut cell = Cell::default();- apply_style(&mut cell, &style);+ apply_style(&mut cell, &self.raw.cursor_style().unwrap());cell}/// The cursor's shape and blinking as DECSCUSR and the defaults set it; `Hidden` while DECTCEM hides it.pub fn cursor_style(&self) -> CursorStyle {- let (mut style, mut visible, mut blinking): (sys::GhosttyCursorStyle, bool, bool) = (0, false, false);- // SAFETY: the render state and terminal are live; the outputs have the types `render.h` documents.- unsafe {- check(sys::ghostty_render_state_update(self.render, self.raw), "ghostty_render_state_update");- check(sys::ghostty_render_state_get(self.render, sys::GHOSTTY_RENDER_STATE_DATA_CURSOR_VISUAL_STYLE, &mut style as *mut _ as *mut c_void), "cursor style");- check(sys::ghostty_render_state_get(self.render, sys::GHOSTTY_RENDER_STATE_DATA_CURSOR_VISIBLE, &mut visible as *mut bool as *mut c_void), "cursor visible");- check(sys::ghostty_render_state_get(self.render, sys::GHOSTTY_RENDER_STATE_DATA_CURSOR_BLINKING, &mut blinking as *mut bool as *mut c_void), "cursor blinking");- }- let shape = match style {- _ if !visible => CursorShape::Hidden,- sys::GHOSTTY_CURSOR_STYLE_BAR => CursorShape::Beam,- sys::GHOSTTY_CURSOR_STYLE_UNDERLINE => CursorShape::Underline,- sys::GHOSTTY_CURSOR_STYLE_BLOCK_HOLLOW => CursorShape::HollowBlock,+ let mut render = self.render.borrow_mut();+ let snapshot = render.state.update(&self.raw).unwrap();+ let blinking = snapshot.cursor_blinking().unwrap();+ let shape = match snapshot.cursor_visual_style().unwrap() {+ _ if !snapshot.cursor_visible().unwrap() => CursorShape::Hidden,+ GhosttyCursorStyle::Bar => CursorShape::Beam,+ GhosttyCursorStyle::Underline => CursorShape::Underline,+ GhosttyCursorStyle::BlockHollow => CursorShape::HollowBlock,_ => CursorShape::Block,};CursorStyle { shape, blinking }@@ -662,32 +643,26 @@ impl Term {/// The viewport's distance from the bottom, in lines.pub fn display_offset(&self) -> usize {- let mut scrollbar = sys::GhosttyTerminalScrollbar::default();- self.get(sys::GHOSTTY_TERMINAL_DATA_SCROLLBAR, &mut scrollbar);+ let scrollbar = self.raw.scrollbar().unwrap();(scrollbar.total - scrollbar.offset - scrollbar.len) as usize}pub fn scroll_display(&mut self, scroll: Scroll) {let page = self.screen_lines() as isize;- let (tag, value) = match scroll {- Scroll::Delta(lines) => (sys::GHOSTTY_TERMINAL_SCROLL_VIEWPORT_DELTA, sys::GhosttyTerminalScrollViewportValue { delta: -(lines as isize) }),- Scroll::PageUp => (sys::GHOSTTY_TERMINAL_SCROLL_VIEWPORT_DELTA, sys::GhosttyTerminalScrollViewportValue { delta: -page }),- Scroll::PageDown => (sys::GHOSTTY_TERMINAL_SCROLL_VIEWPORT_DELTA, sys::GhosttyTerminalScrollViewportValue { delta: page }),- Scroll::Top => (sys::GHOSTTY_TERMINAL_SCROLL_VIEWPORT_ROW, sys::GhosttyTerminalScrollViewportValue { row: self.hidden_rows() }),- Scroll::Bottom => (sys::GHOSTTY_TERMINAL_SCROLL_VIEWPORT_BOTTOM, sys::GhosttyTerminalScrollViewportValue::default()),+ let viewport = match scroll {+ Scroll::Delta(lines) => ScrollViewport::Delta(-(lines as isize)),+ Scroll::PageUp => ScrollViewport::Delta(-page),+ Scroll::PageDown => ScrollViewport::Delta(page),+ Scroll::Top => ScrollViewport::Row(self.hidden_rows()),+ Scroll::Bottom => ScrollViewport::Bottom,};- self.scroll_viewport(tag, value);+ self.raw.scroll_viewport(viewport).unwrap();let hidden = self.hidden_rows();if hidden > 0 && self.display_offset() > self.history_size() {- self.scroll_viewport(sys::GHOSTTY_TERMINAL_SCROLL_VIEWPORT_ROW, sys::GhosttyTerminalScrollViewportValue { row: hidden });+ self.raw.scroll_viewport(ScrollViewport::Row(hidden)).unwrap();}}- fn scroll_viewport(&mut self, tag: sys::GhosttyTerminalScrollViewportTag, value: sys::GhosttyTerminalScrollViewportValue) {- // SAFETY: `raw` is a live terminal and `value` holds the field `tag` names.- check(unsafe { sys::ghostty_terminal_scroll_viewport(self.raw, sys::GhosttyTerminalScrollViewport { tag, value }) }, "ghostty_terminal_scroll_viewport");- }-/// Scrolls so `point` is in the viewport, as little as needed.pub fn scroll_to_point(&mut self, point: Point) {let offset = self.display_offset() as i32;@@ -701,227 +676,192 @@ impl Term {/// The point as Ghostty addresses it. Active lines use the active tag, which Ghostty resolves from the bottom;/// scrollback lines count from the oldest row it keeps.- fn screen_point(&self, point: Point) -> sys::GhosttyPoint {+ fn screen_point(&self, point: Point) -> GhosttyPoint {assert!(point.line >= self.topmost_line() && point.line <= self.bottommost_line(), "line {} is outside the terminal", point.line.0);- let (tag, y) = match point.line.0 {- line if line >= 0 => (sys::GHOSTTY_POINT_TAG_ACTIVE, line as usize),- line => (sys::GHOSTTY_POINT_TAG_SCREEN, (self.scrollback_rows() as i64 + line as i64) as usize),- };- sys::GhosttyPoint { tag, value: sys::GhosttyPointValue { coordinate: sys::GhosttyPointCoordinate { x: point.column.0 as u16, y: y as u32 } } }+ let x = point.column.0 as u16;+ match point.line.0 {+ line if line >= 0 => GhosttyPoint::Active(Coordinate { x, y: line as u32 }),+ line => GhosttyPoint::Screen(Coordinate { x, y: (self.scrollback_rows() as i64 + line as i64) as u32 }),+ }}- fn grid_ref(&self, point: Point) -> sys::GhosttyGridRef {- let mut grid_ref = sys::GhosttyGridRef { node: ptr::null_mut(), x: 0, y: 0 };- // SAFETY: `raw` is a live terminal; the ref is used before the terminal changes, as `&self` holds it still.- check(unsafe { sys::ghostty_terminal_grid_ref(self.raw, self.screen_point(point), &mut grid_ref) }, "ghostty_terminal_grid_ref");- grid_ref+ fn grid_ref(&self, point: Point) -> GridRef<'_> {+ self.raw.grid_ref(self.screen_point(point)).unwrap()}/// Whether `line` continues on the next one.pub fn wraps(&self, line: Line) -> bool {- let grid_ref = self.grid_ref(Point::new(line, Column(0)));- let (mut row, mut wrap): (sys::GhosttyRow, bool) = (0, false);- // SAFETY: `grid_ref` is fresh; the outputs have the documented types.- unsafe {- check(sys::ghostty_grid_ref_row(&grid_ref, &mut row), "ghostty_grid_ref_row");- check(sys::ghostty_row_get(row, sys::GHOSTTY_ROW_DATA_WRAP, &mut wrap as *mut bool as *mut c_void), "ghostty_row_get");- }- wrap+ self.grid_ref(Point::new(line, Column(0))).row().unwrap().is_wrapped().unwrap()}pub fn cell(&self, point: Point) -> Cell {- let grid_ref = self.grid_ref(point);- let mut cell = self.read_cell(&grid_ref);+ let mut cell = read_cell(&self.grid_ref(point));if point.column.0 + 1 == self.columns() && self.wraps(point.line) {cell.flags.insert(Flags::WRAPLINE);}cell}+ /// Any line's cells, one grid reference per cell; `viewport_rows` reads the visible lines faster.pub fn row(&self, line: Line) -> Row {let columns = self.columns();- let mut cells: Vec<Cell> = (0..columns).map(|column| self.read_cell(&self.grid_ref(Point::new(line, Column(column))))).collect();+ let mut cells: Vec<Cell> = (0..columns).map(|column| read_cell(&self.grid_ref(Point::new(line, Column(column))))).collect();if self.wraps(line) {cells[columns - 1].flags.insert(Flags::WRAPLINE);}Row(cells)}- fn read_cell(&self, grid_ref: &sys::GhosttyGridRef) -> Cell {- let mut raw: sys::GhosttyCell = 0;- let (mut codepoint, mut tag, mut wide): (u32, sys::GhosttyCellContentTag, sys::GhosttyCellWide) = (0, 0, 0);- let mut style = sys::GhosttyStyle::default();- // SAFETY: `grid_ref` came from this terminal with no change since; the outputs have the documented types.- unsafe {- check(sys::ghostty_grid_ref_cell(grid_ref, &mut raw), "ghostty_grid_ref_cell");- check(sys::ghostty_cell_get(raw, sys::GHOSTTY_CELL_DATA_CODEPOINT, &mut codepoint as *mut u32 as *mut c_void), "codepoint");- check(sys::ghostty_cell_get(raw, sys::GHOSTTY_CELL_DATA_CONTENT_TAG, &mut tag as *mut _ as *mut c_void), "content tag");- check(sys::ghostty_cell_get(raw, sys::GHOSTTY_CELL_DATA_WIDE, &mut wide as *mut _ as *mut c_void), "wide");- check(sys::ghostty_grid_ref_style(grid_ref, &mut style), "ghostty_grid_ref_style");- }- let mut cell = Cell { c: char::from_u32(codepoint).filter(|&c| c != '\0').unwrap_or(' '), ..Cell::default() };- apply_style(&mut cell, &style);- match tag {- sys::GHOSTTY_CELL_CONTENT_CODEPOINT_GRAPHEME => cell.zerowidth = self.graphemes(grid_ref).into_iter().skip(1).collect(),- sys::GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE => {- let mut index: u8 = 0;- // SAFETY: the tag says the cell holds a palette background.- check(unsafe { sys::ghostty_cell_get(raw, sys::GHOSTTY_CELL_DATA_COLOR_PALETTE, &mut index as *mut u8 as *mut c_void) }, "palette");- cell.bg = Color::Indexed(index);+ /// The viewport's rows, top to bottom, from the render state: one call reads a row's raw cells, where `row`+ /// resolves a grid reference per cell.+ pub fn viewport_rows(&self) -> Vec<Row> {+ let mut render = self.render.borrow_mut();+ let Render { state, rows, cells } = &mut *render;+ let snapshot = state.update(&self.raw).unwrap();+ let mut iteration = rows.update(&snapshot).unwrap();+ let mut viewport = Vec::with_capacity(self.screen_lines());+ while let Some(row) = iteration.next() {+ let mut cell_iteration = cells.update(row).unwrap();+ // Style ids index the row's page, so they are cached per row.+ let mut styles: Vec<(libghostty_vt::style::Id, Style)> = Vec::new();+ let mut line = Vec::with_capacity(self.columns());+ for (x, raw) in row.cells_raw().unwrap().enumerate() {+ let fields = cell_fields(raw);+ let style = match fields.style {+ Some(id) => match styles.iter().find(|(cached, _)| *cached == id) {+ Some((_, style)) => *style,+ None => {+ cell_iteration.select(x as u16).unwrap();+ let style = cell_iteration.style().unwrap();+ styles.push((id, style));+ style+ }+ },+ None => Style::default(),+ };+ let graphemes = match fields.tag {+ CellContentTag::CodepointGrapheme => {+ cell_iteration.select(x as u16).unwrap();+ cell_iteration.graphemes().unwrap()+ }+ _ => Vec::new(),+ };+ line.push(make_cell(raw, &fields, &style, graphemes));}- sys::GHOSTTY_CELL_CONTENT_BG_COLOR_RGB => {- let mut rgb = sys::GhosttyColorRgb::default();- // SAFETY: the tag says the cell holds an RGB background.- check(unsafe { sys::ghostty_cell_get(raw, sys::GHOSTTY_CELL_DATA_COLOR_RGB, &mut rgb as *mut _ as *mut c_void) }, "rgb");- cell.bg = Color::Spec(Rgb { r: rgb.r, g: rgb.g, b: rgb.b });+ if row.raw_row().unwrap().is_wrapped().unwrap()+ && let Some(last) = line.last_mut()+ {+ last.flags.insert(Flags::WRAPLINE);}- _ => {}- }- match wide {- sys::GHOSTTY_CELL_WIDE_WIDE => cell.flags.insert(Flags::WIDE_CHAR),- sys::GHOSTTY_CELL_WIDE_SPACER_TAIL => cell.flags.insert(Flags::WIDE_CHAR_SPACER),- sys::GHOSTTY_CELL_WIDE_SPACER_HEAD => cell.flags.insert(Flags::LEADING_WIDE_CHAR_SPACER),- _ => {}+ viewport.push(Row(line));}- cell- }-- fn graphemes(&self, grid_ref: &sys::GhosttyGridRef) -> Vec<char> {- let mut buffer = [0u32; 16];- let mut written = 0usize;- // SAFETY: `buffer` holds `buffer.len()` codepoints; on OUT_OF_SPACE the heap buffer is sized to `written`.- let mut result = unsafe { sys::ghostty_grid_ref_graphemes(grid_ref, buffer.as_mut_ptr(), buffer.len(), &mut written) };- let mut heap = Vec::new();- if result == sys::GHOSTTY_OUT_OF_SPACE {- heap = vec![0u32; written];- // SAFETY: as above, with the heap buffer of `written` codepoints.- result = unsafe { sys::ghostty_grid_ref_graphemes(grid_ref, heap.as_mut_ptr(), heap.len(), &mut written) };- }- check(result, "ghostty_grid_ref_graphemes");- let codepoints = if heap.is_empty() { &buffer[..written] } else { &heap[..written] };- codepoints.iter().filter_map(|&codepoint| char::from_u32(codepoint)).collect()+ viewport}/// A ref that follows `point`'s cell as output scrolls it up; `None` once the scrollback drops the cell.fn track(&self, point: Point) -> TrackedPoint {- let mut tracked = ptr::null_mut();- // SAFETY: `raw` is a live terminal; the ref is freed by `TrackedPoint`'s drop before the terminal's.- check(unsafe { sys::ghostty_terminal_grid_ref_track(self.raw, self.screen_point(point), &mut tracked) }, "ghostty_terminal_grid_ref_track");- TrackedPoint(tracked)+ self.raw.track_grid_ref(self.screen_point(point)).unwrap()}fn tracked_point(&self, tracked: &TrackedPoint) -> Option<Point> {- let mut coordinate = sys::GhosttyPointCoordinate::default();- // SAFETY: the ref belongs to this terminal, which is live.- let found = unsafe { sys::ghostty_tracked_grid_ref_has_value(tracked.0) && sys::ghostty_tracked_grid_ref_point(tracked.0, sys::GHOSTTY_POINT_TAG_SCREEN, &mut coordinate) == sys::GHOSTTY_SUCCESS };+ if !tracked.has_value() {+ return None;+ }+ let coordinate = tracked.point(Space::Screen).unwrap()?;let line = coordinate.y as i64 - self.scrollback_rows() as i64;- (found && line >= -(self.history_size() as i64)).then(|| Point::new(Line(line as i32), Column(coordinate.x as usize)))+ (line >= -(self.history_size() as i64)).then(|| Point::new(Line(line as i32), Column(coordinate.x as usize)))}pub fn title(&self) -> String {- let mut title = sys::GhosttyString { ptr: ptr::null(), len: 0 };- self.get(sys::GHOSTTY_TERMINAL_DATA_TITLE, &mut title);- borrowed_string(title)+ String::from_utf8_lossy(self.raw.title().unwrap()).into_owned()}}-struct TrackedPoint(sys::GhosttyTrackedGridRef);+use TrackedGridRef as TrackedPoint;-impl Drop for TrackedPoint {- fn drop(&mut self) {- // SAFETY: created by `ghostty_terminal_grid_ref_track` and freed once; `Term` drops its selection first.- unsafe { sys::ghostty_tracked_grid_ref_free(self.0) };- }+/// The fields of a raw cell the port reads, in one call.+struct CellFields {+ codepoint: char,+ tag: CellContentTag,+ wide: CellWide,+ /// The cell's style id, `None` for the default style.+ style: Option<libghostty_vt::style::Id>,}-fn borrowed_string(string: sys::GhosttyString) -> String {- if string.ptr.is_null() || string.len == 0 {- return String::new();- }- // SAFETY: the library returned `len` bytes at `ptr`, valid until the terminal changes; they are copied now.- String::from_utf8_lossy(unsafe { std::slice::from_raw_parts(string.ptr, string.len) }).into_owned()+fn cell_fields(raw: screen::Cell) -> CellFields {+ let (codepoint, tag, wide, styled, style) = raw.get_multi((cell::Codepoint, cell::ContentTag, cell::Wide, cell::HasStyling, cell::StyleId)).unwrap();+ CellFields { codepoint, tag, wide, style: styled.then_some(style) }}-fn style_color(color: &sys::GhosttyStyleColor) -> Option<Color> {- // SAFETY: the tag names the union field the library wrote.- match color.tag as sys::GhosttyStyleColorTag {- sys::GHOSTTY_STYLE_COLOR_PALETTE => Some(Color::Indexed(unsafe { color.value.palette })),- sys::GHOSTTY_STYLE_COLOR_RGB => {- let rgb = unsafe { color.value.rgb };- Some(Color::Spec(Rgb { r: rgb.r, g: rgb.g, b: rgb.b }))- }- _ => None,- }+fn read_cell(grid_ref: &GridRef<'_>) -> Cell {+ let raw = grid_ref.cell().unwrap();+ let fields = cell_fields(raw);+ let style = grid_ref.style().unwrap();+ let graphemes = match fields.tag {+ CellContentTag::CodepointGrapheme => grid_ref_graphemes(grid_ref),+ _ => Vec::new(),+ };+ make_cell(raw, &fields, &style, graphemes)}-fn apply_style(cell: &mut Cell, style: &sys::GhosttyStyle) {- cell.fg = style_color(&style.fg_color).unwrap_or(Color::Foreground);- cell.bg = style_color(&style.bg_color).unwrap_or(Color::Background);- cell.underline_color = style_color(&style.underline_color);- let attributes = [(0, Flags::BOLD), (1, Flags::ITALIC), (2, Flags::DIM), (4, Flags::INVERSE), (5, Flags::HIDDEN), (6, Flags::STRIKEOUT)];- for (bit, flag) in attributes {- if style.flags & (1 << bit) != 0 {- cell.flags.insert(flag);+/// The cell's grapheme cluster, its base codepoint first.+fn grid_ref_graphemes(grid_ref: &GridRef<'_>) -> Vec<char> {+ let mut buffer = vec!['\0'; 16];+ let written = match grid_ref.graphemes(&mut buffer) {+ Err(libghostty_vt::Error::OutOfSpace { required }) => {+ buffer.resize(required, '\0');+ grid_ref.graphemes(&mut buffer).unwrap()}- }- let underline = match (style.flags >> 8) & 0x7 {- 1 => Flags::UNDERLINE,- 2 => Flags::DOUBLE_UNDERLINE,- 3 => Flags::UNDERCURL,- 4 => Flags::DOTTED_UNDERLINE,- 5 => Flags::DASHED_UNDERLINE,- _ => Flags::empty(),+ written => written.unwrap(),};- cell.flags.insert(underline);-}--/// # Safety-/// Ghostty calls it with the userdata `install_callbacks` set, a live `Callbacks`, and `len` bytes at `data`.-unsafe extern "C" fn write_pty(_: sys::GhosttyTerminal, userdata: *mut c_void, data: *const u8, len: usize) {- let callbacks = unsafe { &mut *(userdata as *mut Callbacks) };- callbacks.effects.pty_write.extend_from_slice(unsafe { std::slice::from_raw_parts(data, len) });+ buffer.truncate(written);+ buffer}-/// # Safety-/// As `write_pty`.-unsafe extern "C" fn bell(_: sys::GhosttyTerminal, userdata: *mut c_void) {- unsafe { &mut *(userdata as *mut Callbacks) }.effects.bell = true;-}--/// # Safety-/// As `write_pty`; the terminal is live and not being written to from Rust.-unsafe extern "C" fn title_changed(terminal: sys::GhosttyTerminal, userdata: *mut c_void) {- let mut title = sys::GhosttyString { ptr: ptr::null(), len: 0 };- if unsafe { sys::ghostty_terminal_get(terminal, sys::GHOSTTY_TERMINAL_DATA_TITLE, &mut title as *mut _ as *mut c_void) } == sys::GHOSTTY_SUCCESS {- unsafe { &mut *(userdata as *mut Callbacks) }.effects.title = Some(borrowed_string(title));+fn make_cell(raw: screen::Cell, fields: &CellFields, style: &Style, graphemes: Vec<char>) -> Cell {+ let mut cell = Cell { c: if fields.codepoint == '\0' { ' ' } else { fields.codepoint }, ..Cell::default() };+ apply_style(&mut cell, style);+ match fields.tag {+ CellContentTag::CodepointGrapheme => cell.zerowidth = graphemes.into_iter().skip(1).collect(),+ CellContentTag::BgColorPalette => cell.bg = Color::Indexed(raw.bg_color_palette().unwrap().0),+ CellContentTag::BgColorRgb => cell.bg = Color::Spec(raw.bg_color_rgb().unwrap()),+ CellContentTag::Codepoint => {}+ }+ match fields.wide {+ CellWide::Wide => cell.flags.insert(Flags::WIDE_CHAR),+ CellWide::SpacerTail => cell.flags.insert(Flags::WIDE_CHAR_SPACER),+ CellWide::SpacerHead => cell.flags.insert(Flags::LEADING_WIDE_CHAR_SPACER),+ CellWide::Narrow => {}}+ cell}-/// # Safety-/// As `write_pty`, with `out` valid for one write.-unsafe extern "C" fn size(_: sys::GhosttyTerminal, userdata: *mut c_void, out: *mut sys::GhosttySizeReportSize) -> bool {- unsafe { *out = (*(userdata as *mut Callbacks)).size };- true+fn style_color(color: StyleColor) -> Option<Color> {+ match color {+ StyleColor::None => None,+ StyleColor::Palette(index) => Some(Color::Indexed(index.0)),+ StyleColor::Rgb(rgb) => Some(Color::Spec(rgb)),+ }}-/// xterm.js `CSI c` (`?1;2c`) and `CSI > c` (`>0;276;0c`).-///-/// # Safety-/// `out` is valid for one write.-unsafe extern "C" fn device_attributes(_: sys::GhosttyTerminal, _: *mut c_void, out: *mut sys::GhosttyDeviceAttributes) -> bool {- let mut attributes = sys::GhosttyDeviceAttributes::default();- attributes.primary.conformance_level = 1;- attributes.primary.features[0] = 2;- attributes.primary.num_features = 1;- attributes.secondary = sys::GhosttyDeviceAttributesSecondary { device_type: 0, firmware_version: 276, rom_cartridge: 0 };- unsafe { *out = attributes };- true-}--/// # Safety-/// Returns a pointer to a static string, which Ghostty copies.-unsafe extern "C" fn xtversion(_: sys::GhosttyTerminal, _: *mut c_void) -> sys::GhosttyString {- sys::GhosttyString { ptr: XTVERSION.as_ptr(), len: XTVERSION.len() }+fn apply_style(cell: &mut Cell, style: &Style) {+ cell.fg = style_color(style.fg_color).unwrap_or(Color::Foreground);+ cell.bg = style_color(style.bg_color).unwrap_or(Color::Background);+ cell.underline_color = style_color(style.underline_color);+ let attributes = [(style.bold, Flags::BOLD), (style.italic, Flags::ITALIC), (style.faint, Flags::DIM), (style.inverse, Flags::INVERSE), (style.invisible, Flags::HIDDEN), (style.strikethrough, Flags::STRIKEOUT)];+ for (set, flag) in attributes {+ if set {+ cell.flags.insert(flag);+ }+ }+ cell.flags.insert(match style.underline {+ Underline::Single => Flags::UNDERLINE,+ Underline::Double => Flags::DOUBLE_UNDERLINE,+ Underline::Curly => Flags::UNDERCURL,+ Underline::Dotted => Flags::DOTTED_UNDERLINE,+ Underline::Dashed => Flags::DASHED_UNDERLINE,+ _ => Flags::empty(),+ });}#[cfg(test)]diff --git a/native/crates/ghostty_vt/src/sys.rs b/native/crates/ghostty_vt/src/sys.rsdeleted file mode 100644index 22f107d226a..00000000000--- a/native/crates/ghostty_vt/src/sys.rs+++ /dev/null@@ -1,3220 +0,0 @@-//! libghostty-vt 1.0.2 `include/ghostty/vt.h` through bindgen 0.72.1: allowlist `ghostty_.*`, `Ghostty.*` and-//! `GHOSTTY_.*`, enums as consts without their name prefix, `use_core`, no layout tests, `derive_default`.-#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case, dead_code, clippy::all)]---pub const GHOSTTY_VT_VERSION_MAJOR: u32 = 1;-pub const GHOSTTY_VT_VERSION_MINOR: u32 = 0;-pub const GHOSTTY_VT_VERSION_PATCH: u32 = 2;-pub const GHOSTTY_VT_VERSION: &[u8; 6] = b"1.0.2\0";-pub const GHOSTTY_ENUM_MAX_VALUE: u32 = 2147483647;-pub const GHOSTTY_COLOR_NAMED_BLACK: u32 = 0;-pub const GHOSTTY_COLOR_NAMED_RED: u32 = 1;-pub const GHOSTTY_COLOR_NAMED_GREEN: u32 = 2;-pub const GHOSTTY_COLOR_NAMED_YELLOW: u32 = 3;-pub const GHOSTTY_COLOR_NAMED_BLUE: u32 = 4;-pub const GHOSTTY_COLOR_NAMED_MAGENTA: u32 = 5;-pub const GHOSTTY_COLOR_NAMED_CYAN: u32 = 6;-pub const GHOSTTY_COLOR_NAMED_WHITE: u32 = 7;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_BLACK: u32 = 8;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_RED: u32 = 9;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_GREEN: u32 = 10;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_YELLOW: u32 = 11;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_BLUE: u32 = 12;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_MAGENTA: u32 = 13;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_CYAN: u32 = 14;-pub const GHOSTTY_COLOR_NAMED_BRIGHT_WHITE: u32 = 15;-pub const GHOSTTY_DA_CONFORMANCE_VT100: u32 = 1;-pub const GHOSTTY_DA_CONFORMANCE_VT101: u32 = 1;-pub const GHOSTTY_DA_CONFORMANCE_VT102: u32 = 6;-pub const GHOSTTY_DA_CONFORMANCE_VT125: u32 = 12;-pub const GHOSTTY_DA_CONFORMANCE_VT131: u32 = 7;-pub const GHOSTTY_DA_CONFORMANCE_VT132: u32 = 4;-pub const GHOSTTY_DA_CONFORMANCE_VT220: u32 = 62;-pub const GHOSTTY_DA_CONFORMANCE_VT240: u32 = 62;-pub const GHOSTTY_DA_CONFORMANCE_VT320: u32 = 63;-pub const GHOSTTY_DA_CONFORMANCE_VT340: u32 = 63;-pub const GHOSTTY_DA_CONFORMANCE_VT420: u32 = 64;-pub const GHOSTTY_DA_CONFORMANCE_VT510: u32 = 65;-pub const GHOSTTY_DA_CONFORMANCE_VT520: u32 = 65;-pub const GHOSTTY_DA_CONFORMANCE_VT525: u32 = 65;-pub const GHOSTTY_DA_CONFORMANCE_LEVEL_2: u32 = 62;-pub const GHOSTTY_DA_CONFORMANCE_LEVEL_3: u32 = 63;-pub const GHOSTTY_DA_CONFORMANCE_LEVEL_4: u32 = 64;-pub const GHOSTTY_DA_CONFORMANCE_LEVEL_5: u32 = 65;-pub const GHOSTTY_DA_FEATURE_COLUMNS_132: u32 = 1;-pub const GHOSTTY_DA_FEATURE_PRINTER: u32 = 2;-pub const GHOSTTY_DA_FEATURE_REGIS: u32 = 3;-pub const GHOSTTY_DA_FEATURE_SIXEL: u32 = 4;-pub const GHOSTTY_DA_FEATURE_SELECTIVE_ERASE: u32 = 6;-pub const GHOSTTY_DA_FEATURE_USER_DEFINED_KEYS: u32 = 8;-pub const GHOSTTY_DA_FEATURE_NATIONAL_REPLACEMENT: u32 = 9;-pub const GHOSTTY_DA_FEATURE_TECHNICAL_CHARACTERS: u32 = 15;-pub const GHOSTTY_DA_FEATURE_LOCATOR: u32 = 16;-pub const GHOSTTY_DA_FEATURE_TERMINAL_STATE: u32 = 17;-pub const GHOSTTY_DA_FEATURE_WINDOWING: u32 = 18;-pub const GHOSTTY_DA_FEATURE_HORIZONTAL_SCROLLING: u32 = 21;-pub const GHOSTTY_DA_FEATURE_ANSI_COLOR: u32 = 22;-pub const GHOSTTY_DA_FEATURE_RECTANGULAR_EDITING: u32 = 28;-pub const GHOSTTY_DA_FEATURE_ANSI_TEXT_LOCATOR: u32 = 29;-pub const GHOSTTY_DA_FEATURE_CLIPBOARD: u32 = 52;-pub const GHOSTTY_DA_DEVICE_TYPE_VT100: u32 = 0;-pub const GHOSTTY_DA_DEVICE_TYPE_VT220: u32 = 1;-pub const GHOSTTY_DA_DEVICE_TYPE_VT240: u32 = 2;-pub const GHOSTTY_DA_DEVICE_TYPE_VT330: u32 = 18;-pub const GHOSTTY_DA_DEVICE_TYPE_VT340: u32 = 19;-pub const GHOSTTY_DA_DEVICE_TYPE_VT320: u32 = 24;-pub const GHOSTTY_DA_DEVICE_TYPE_VT382: u32 = 32;-pub const GHOSTTY_DA_DEVICE_TYPE_VT420: u32 = 41;-pub const GHOSTTY_DA_DEVICE_TYPE_VT510: u32 = 61;-pub const GHOSTTY_DA_DEVICE_TYPE_VT520: u32 = 64;-pub const GHOSTTY_DA_DEVICE_TYPE_VT525: u32 = 65;-pub const GHOSTTY_STYLE_UNDERLINE_SHIFT: u32 = 8;-pub const GHOSTTY_FORMATTER_EXTRA_PALETTE: u32 = 1;-pub const GHOSTTY_FORMATTER_EXTRA_MODES: u32 = 2;-pub const GHOSTTY_FORMATTER_EXTRA_SCROLLING_REGION: u32 = 4;-pub const GHOSTTY_FORMATTER_EXTRA_TABSTOPS: u32 = 8;-pub const GHOSTTY_FORMATTER_EXTRA_PWD: u32 = 16;-pub const GHOSTTY_FORMATTER_EXTRA_KEYBOARD: u32 = 32;-pub const GHOSTTY_FORMATTER_EXTRA_CURSOR: u32 = 64;-pub const GHOSTTY_FORMATTER_EXTRA_STYLE: u32 = 128;-pub const GHOSTTY_FORMATTER_EXTRA_HYPERLINK: u32 = 256;-pub const GHOSTTY_FORMATTER_EXTRA_PROTECTION: u32 = 512;-pub const GHOSTTY_FORMATTER_EXTRA_KITTY_KEYBOARD: u32 = 1024;-pub const GHOSTTY_FORMATTER_EXTRA_CHARSETS: u32 = 2048;-pub const GHOSTTY_FORMATTER_EXTRAS_NONE: u32 = 0;-pub const GHOSTTY_FORMATTER_EXTRAS_ALL: u32 = 4095;-pub const GHOSTTY_FORMATTER_EXTRAS_DEFAULT: u32 = 385;-pub const GHOSTTY_MODS_SHIFT: u32 = 1;-pub const GHOSTTY_MODS_CTRL: u32 = 2;-pub const GHOSTTY_MODS_ALT: u32 = 4;-pub const GHOSTTY_MODS_SUPER: u32 = 8;-pub const GHOSTTY_MODS_CAPS_LOCK: u32 = 16;-pub const GHOSTTY_MODS_NUM_LOCK: u32 = 32;-pub const GHOSTTY_MODS_SHIFT_SIDE: u32 = 64;-pub const GHOSTTY_MODS_CTRL_SIDE: u32 = 128;-pub const GHOSTTY_MODS_ALT_SIDE: u32 = 256;-pub const GHOSTTY_MODS_SUPER_SIDE: u32 = 512;-pub const GHOSTTY_KITTY_KEY_DISABLED: u32 = 0;-pub const GHOSTTY_KITTY_KEY_DISAMBIGUATE: u32 = 1;-pub const GHOSTTY_KITTY_KEY_REPORT_EVENTS: u32 = 2;-pub const GHOSTTY_KITTY_KEY_REPORT_ALTERNATES: u32 = 4;-pub const GHOSTTY_KITTY_KEY_REPORT_ALL: u32 = 8;-pub const GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED: u32 = 16;-pub const GHOSTTY_KITTY_KEY_ALL: u32 = 31;-pub const GHOSTTY_SUCCESS: GhosttyResult = 0;-pub const GHOSTTY_OUT_OF_MEMORY: GhosttyResult = -1;-pub const GHOSTTY_INVALID_VALUE: GhosttyResult = -2;-pub const GHOSTTY_OUT_OF_SPACE: GhosttyResult = -3;-pub const GHOSTTY_NO_VALUE: GhosttyResult = -4;-pub const GHOSTTY_IO_ERROR: GhosttyResult = -5;-pub const GHOSTTY_LIMIT_EXCEEDED: GhosttyResult = -6;-pub const GHOSTTY_REJECTED: GhosttyResult = -7;-pub const GHOSTTY_UNSUPPORTED: GhosttyResult = -8;-pub const GHOSTTY_RESULT_MAX_VALUE: GhosttyResult = 2147483647;-pub type GhosttyResult = ::core::ffi::c_int;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalImpl {- _unused: [u8; 0],-}-pub type GhosttyTerminal = *mut GhosttyTerminalImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySnapshotDecoderImpl {- _unused: [u8; 0],-}-pub type GhosttySnapshotDecoder = *mut GhosttySnapshotDecoderImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTrackedGridRefImpl {- _unused: [u8; 0],-}-pub type GhosttyTrackedGridRef = *mut GhosttyTrackedGridRefImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyKittyGraphicsImpl {- _unused: [u8; 0],-}-pub type GhosttyKittyGraphics = *mut GhosttyKittyGraphicsImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyKittyGraphicsImageImpl {- _unused: [u8; 0],-}-pub type GhosttyKittyGraphicsImage = *const GhosttyKittyGraphicsImageImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyKittyGraphicsPlacementIteratorImpl {- _unused: [u8; 0],-}-pub type GhosttyKittyGraphicsPlacementIterator = *mut GhosttyKittyGraphicsPlacementIteratorImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyRenderStateImpl {- _unused: [u8; 0],-}-pub type GhosttyRenderState = *mut GhosttyRenderStateImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyRenderStateRowIteratorImpl {- _unused: [u8; 0],-}-pub type GhosttyRenderStateRowIterator = *mut GhosttyRenderStateRowIteratorImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyRenderStateRowCellsImpl {- _unused: [u8; 0],-}-pub type GhosttyRenderStateRowCells = *mut GhosttyRenderStateRowCellsImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyRenderStateImageIteratorImpl {- _unused: [u8; 0],-}-pub type GhosttyRenderStateImageIterator = *mut GhosttyRenderStateImageIteratorImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySearchImpl {- _unused: [u8; 0],-}-pub type GhosttySearch = *mut GhosttySearchImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySgrParserImpl {- _unused: [u8; 0],-}-pub type GhosttySgrParser = *mut GhosttySgrParserImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyFormatterImpl {- _unused: [u8; 0],-}-pub type GhosttyFormatter = *mut GhosttyFormatterImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyOscParserImpl {- _unused: [u8; 0],-}-pub type GhosttyOscParser = *mut GhosttyOscParserImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyOscCommandImpl {- _unused: [u8; 0],-}-pub type GhosttyOscCommand = *mut GhosttyOscCommandImpl;-pub const GHOSTTY_FORMATTER_FORMAT_PLAIN: GhosttyFormatterFormat = 0;-pub const GHOSTTY_FORMATTER_FORMAT_VT: GhosttyFormatterFormat = 1;-pub const GHOSTTY_FORMATTER_FORMAT_HTML: GhosttyFormatterFormat = 2;-pub const GHOSTTY_FORMATTER_FORMAT_MAX_VALUE: GhosttyFormatterFormat = 2147483647;-pub type GhosttyFormatterFormat = ::core::ffi::c_uint;-pub const GHOSTTY_CURSOR_STYLE_BAR: GhosttyCursorStyle = 0;-pub const GHOSTTY_CURSOR_STYLE_BLOCK: GhosttyCursorStyle = 1;-pub const GHOSTTY_CURSOR_STYLE_UNDERLINE: GhosttyCursorStyle = 2;-pub const GHOSTTY_CURSOR_STYLE_BLOCK_HOLLOW: GhosttyCursorStyle = 3;-pub const GHOSTTY_CURSOR_STYLE_MAX_VALUE: GhosttyCursorStyle = 2147483647;-pub type GhosttyCursorStyle = ::core::ffi::c_uint;-pub const GHOSTTY_IMAGE_LAYER_BELOW_BACKGROUND: GhosttyImageLayer = 0;-pub const GHOSTTY_IMAGE_LAYER_BELOW_TEXT: GhosttyImageLayer = 1;-pub const GHOSTTY_IMAGE_LAYER_ABOVE_TEXT: GhosttyImageLayer = 2;-pub const GHOSTTY_IMAGE_LAYER_MAX_VALUE: GhosttyImageLayer = 2147483647;-pub type GhosttyImageLayer = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyString {- pub ptr: *const u8,- pub len: usize,-}-impl Default for GhosttyString {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyBuffer {- pub ptr: *mut u8,- pub cap: usize,- pub len: usize,-}-impl Default for GhosttyBuffer {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttySurfacePosition {- pub x: f64,- pub y: f64,-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyCodepoints {- pub ptr: *const u32,- pub len: usize,-}-impl Default for GhosttyCodepoints {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyCodepointBuffer {- pub ptr: *mut u32,- pub cap: usize,- pub len: usize,-}-impl Default for GhosttyCodepointBuffer {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyAllocatorAllocFn = ::core::option::Option<- unsafe extern "C" fn(- ctx: *mut ::core::ffi::c_void,- len: usize,- alignment: u8,- ret_addr: usize,- ) -> *mut ::core::ffi::c_void,->;-pub type GhosttyAllocatorResizeFn = ::core::option::Option<- unsafe extern "C" fn(- ctx: *mut ::core::ffi::c_void,- memory: *mut ::core::ffi::c_void,- memory_len: usize,- alignment: u8,- new_len: usize,- ret_addr: usize,- ) -> bool,->;-pub type GhosttyAllocatorRemapFn = ::core::option::Option<- unsafe extern "C" fn(- ctx: *mut ::core::ffi::c_void,- memory: *mut ::core::ffi::c_void,- memory_len: usize,- alignment: u8,- new_len: usize,- ret_addr: usize,- ) -> *mut ::core::ffi::c_void,->;-pub type GhosttyAllocatorFreeFn = ::core::option::Option<- unsafe extern "C" fn(- ctx: *mut ::core::ffi::c_void,- memory: *mut ::core::ffi::c_void,- memory_len: usize,- alignment: u8,- ret_addr: usize,- ),->;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyAllocatorVtable {- pub alloc: GhosttyAllocatorAllocFn,- pub resize: GhosttyAllocatorResizeFn,- pub remap: GhosttyAllocatorRemapFn,- pub free: GhosttyAllocatorFreeFn,- pub reserved: [*mut ::core::ffi::c_void; 4usize],-}-impl Default for GhosttyAllocatorVtable {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyAllocator {- pub ctx: *mut ::core::ffi::c_void,- pub vtable: *const GhosttyAllocatorVtable,-}-impl Default for GhosttyAllocator {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_OPTIMIZE_DEBUG: GhosttyOptimizeMode = 0;-pub const GHOSTTY_OPTIMIZE_RELEASE_SAFE: GhosttyOptimizeMode = 1;-pub const GHOSTTY_OPTIMIZE_RELEASE_SMALL: GhosttyOptimizeMode = 2;-pub const GHOSTTY_OPTIMIZE_RELEASE_FAST: GhosttyOptimizeMode = 3;-pub const GHOSTTY_OPTIMIZE_MODE_MAX_VALUE: GhosttyOptimizeMode = 2147483647;-pub type GhosttyOptimizeMode = ::core::ffi::c_uint;-pub const GHOSTTY_BUILD_INFO_INVALID: GhosttyBuildInfo = 0;-pub const GHOSTTY_BUILD_INFO_SIMD: GhosttyBuildInfo = 1;-pub const GHOSTTY_BUILD_INFO_KITTY_GRAPHICS: GhosttyBuildInfo = 2;-pub const GHOSTTY_BUILD_INFO_TMUX_CONTROL_MODE: GhosttyBuildInfo = 3;-pub const GHOSTTY_BUILD_INFO_OPTIMIZE: GhosttyBuildInfo = 4;-pub const GHOSTTY_BUILD_INFO_VERSION_STRING: GhosttyBuildInfo = 5;-pub const GHOSTTY_BUILD_INFO_VERSION_MAJOR: GhosttyBuildInfo = 6;-pub const GHOSTTY_BUILD_INFO_VERSION_MINOR: GhosttyBuildInfo = 7;-pub const GHOSTTY_BUILD_INFO_VERSION_PATCH: GhosttyBuildInfo = 8;-pub const GHOSTTY_BUILD_INFO_VERSION_PRE: GhosttyBuildInfo = 9;-pub const GHOSTTY_BUILD_INFO_VERSION_BUILD: GhosttyBuildInfo = 10;-pub const GHOSTTY_BUILD_INFO_FEATURE_SNAPSHOT: GhosttyBuildInfo = 11;-pub const GHOSTTY_BUILD_INFO_FEATURE_FORMATTER: GhosttyBuildInfo = 12;-pub const GHOSTTY_BUILD_INFO_FEATURE_SELECTION: GhosttyBuildInfo = 13;-pub const GHOSTTY_BUILD_INFO_FEATURE_SEARCH: GhosttyBuildInfo = 14;-pub const GHOSTTY_BUILD_INFO_FEATURE_RENDER_STATE: GhosttyBuildInfo = 15;-pub const GHOSTTY_BUILD_INFO_FEATURE_INPUT_ENCODE: GhosttyBuildInfo = 16;-pub const GHOSTTY_BUILD_INFO_FEATURE_COLOR: GhosttyBuildInfo = 17;-pub const GHOSTTY_BUILD_INFO_FEATURE_GRID_INTROSPECTION: GhosttyBuildInfo = 18;-pub const GHOSTTY_BUILD_INFO_FEATURE_GLYPH_PROTOCOL: GhosttyBuildInfo = 19;-pub const GHOSTTY_BUILD_INFO_MAX_VALUE: GhosttyBuildInfo = 2147483647;-pub type GhosttyBuildInfo = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyColorRgb {- pub r: u8,- pub g: u8,- pub b: u8,-}-pub type GhosttyColorPaletteIndex = u8;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyColorPaletteMask {- pub bits: [u64; 4usize],-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyColorX11Entry {- pub name: *const ::core::ffi::c_char,- pub color: GhosttyColorRgb,-}-impl Default for GhosttyColorX11Entry {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_COLOR_SCHEME_LIGHT: GhosttyColorScheme = 0;-pub const GHOSTTY_COLOR_SCHEME_DARK: GhosttyColorScheme = 1;-pub const GHOSTTY_COLOR_SCHEME_MAX_VALUE: GhosttyColorScheme = 2147483647;-pub type GhosttyColorScheme = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyDeviceAttributesPrimary {- pub conformance_level: u16,- pub features: [u16; 64usize],- pub num_features: usize,-}-impl Default for GhosttyDeviceAttributesPrimary {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyDeviceAttributesSecondary {- pub device_type: u16,- pub firmware_version: u16,- pub rom_cartridge: u16,-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyDeviceAttributesTertiary {- pub unit_id: u32,-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyDeviceAttributes {- pub primary: GhosttyDeviceAttributesPrimary,- pub secondary: GhosttyDeviceAttributesSecondary,- pub tertiary: GhosttyDeviceAttributesTertiary,-}-impl Default for GhosttyDeviceAttributes {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_FOCUS_GAINED: GhosttyFocusEvent = 0;-pub const GHOSTTY_FOCUS_LOST: GhosttyFocusEvent = 1;-pub const GHOSTTY_FOCUS_MAX_VALUE: GhosttyFocusEvent = 2147483647;-pub type GhosttyFocusEvent = ::core::ffi::c_uint;-pub type GhosttyReaderFn = ::core::option::Option<- unsafe extern "C" fn(- userdata: *mut ::core::ffi::c_void,- buffer: *mut u8,- capacity: usize,- out_read: *mut usize,- ) -> bool,->;-pub type GhosttyWriterFn = ::core::option::Option<- unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void, data: *const u8, len: usize) -> bool,->;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyReader {- pub read: GhosttyReaderFn,- pub userdata: *mut ::core::ffi::c_void,-}-impl Default for GhosttyReader {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyWriter {- pub write: GhosttyWriterFn,- pub userdata: *mut ::core::ffi::c_void,-}-impl Default for GhosttyWriter {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyMimeReaderFn = ::core::option::Option<- unsafe extern "C" fn(- userdata: *mut ::core::ffi::c_void,- mime: GhosttyString,- writer: GhosttyWriter,- ) -> bool,->;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyMimeReader {- pub read: GhosttyMimeReaderFn,- pub userdata: *mut ::core::ffi::c_void,-}-impl Default for GhosttyMimeReader {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyCell = u64;-pub type GhosttyRow = u64;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyCellsView {- pub ptr: *const GhosttyCell,- pub len: usize,-}-impl Default for GhosttyCellsView {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_CELL_CONTENT_CODEPOINT: GhosttyCellContentTag = 0;-pub const GHOSTTY_CELL_CONTENT_CODEPOINT_GRAPHEME: GhosttyCellContentTag = 1;-pub const GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE: GhosttyCellContentTag = 2;-pub const GHOSTTY_CELL_CONTENT_BG_COLOR_RGB: GhosttyCellContentTag = 3;-pub const GHOSTTY_CELL_CONTENT_TAG_MAX_VALUE: GhosttyCellContentTag = 2147483647;-pub type GhosttyCellContentTag = ::core::ffi::c_uint;-pub const GHOSTTY_CELL_WIDE_NARROW: GhosttyCellWide = 0;-pub const GHOSTTY_CELL_WIDE_WIDE: GhosttyCellWide = 1;-pub const GHOSTTY_CELL_WIDE_SPACER_TAIL: GhosttyCellWide = 2;-pub const GHOSTTY_CELL_WIDE_SPACER_HEAD: GhosttyCellWide = 3;-pub const GHOSTTY_CELL_WIDE_MAX_VALUE: GhosttyCellWide = 2147483647;-pub type GhosttyCellWide = ::core::ffi::c_uint;-pub const GHOSTTY_CELL_SEMANTIC_OUTPUT: GhosttyCellSemanticContent = 0;-pub const GHOSTTY_CELL_SEMANTIC_INPUT: GhosttyCellSemanticContent = 1;-pub const GHOSTTY_CELL_SEMANTIC_PROMPT: GhosttyCellSemanticContent = 2;-pub const GHOSTTY_CELL_SEMANTIC_MAX_VALUE: GhosttyCellSemanticContent = 2147483647;-pub type GhosttyCellSemanticContent = ::core::ffi::c_uint;-pub const GHOSTTY_CELL_DATA_INVALID: GhosttyCellData = 0;-pub const GHOSTTY_CELL_DATA_CODEPOINT: GhosttyCellData = 1;-pub const GHOSTTY_CELL_DATA_CONTENT_TAG: GhosttyCellData = 2;-pub const GHOSTTY_CELL_DATA_WIDE: GhosttyCellData = 3;-pub const GHOSTTY_CELL_DATA_HAS_TEXT: GhosttyCellData = 4;-pub const GHOSTTY_CELL_DATA_HAS_STYLING: GhosttyCellData = 5;-pub const GHOSTTY_CELL_DATA_STYLE_ID: GhosttyCellData = 6;-pub const GHOSTTY_CELL_DATA_HAS_HYPERLINK: GhosttyCellData = 7;-pub const GHOSTTY_CELL_DATA_PROTECTED: GhosttyCellData = 8;-pub const GHOSTTY_CELL_DATA_SEMANTIC_CONTENT: GhosttyCellData = 9;-pub const GHOSTTY_CELL_DATA_COLOR_PALETTE: GhosttyCellData = 10;-pub const GHOSTTY_CELL_DATA_COLOR_RGB: GhosttyCellData = 11;-pub const GHOSTTY_CELL_DATA_MAX_VALUE: GhosttyCellData = 2147483647;-pub type GhosttyCellData = ::core::ffi::c_uint;-pub const GHOSTTY_ROW_SEMANTIC_NONE: GhosttyRowSemanticPrompt = 0;-pub const GHOSTTY_ROW_SEMANTIC_PROMPT: GhosttyRowSemanticPrompt = 1;-pub const GHOSTTY_ROW_SEMANTIC_PROMPT_CONTINUATION: GhosttyRowSemanticPrompt = 2;-pub const GHOSTTY_ROW_SEMANTIC_MAX_VALUE: GhosttyRowSemanticPrompt = 2147483647;-pub type GhosttyRowSemanticPrompt = ::core::ffi::c_uint;-pub const GHOSTTY_ROW_DATA_INVALID: GhosttyRowData = 0;-pub const GHOSTTY_ROW_DATA_WRAP: GhosttyRowData = 1;-pub const GHOSTTY_ROW_DATA_WRAP_CONTINUATION: GhosttyRowData = 2;-pub const GHOSTTY_ROW_DATA_GRAPHEME: GhosttyRowData = 3;-pub const GHOSTTY_ROW_DATA_STYLED: GhosttyRowData = 4;-pub const GHOSTTY_ROW_DATA_HYPERLINK: GhosttyRowData = 5;-pub const GHOSTTY_ROW_DATA_SEMANTIC_PROMPT: GhosttyRowData = 6;-pub const GHOSTTY_ROW_DATA_KITTY_VIRTUAL_PLACEHOLDER: GhosttyRowData = 7;-pub const GHOSTTY_ROW_DATA_DIRTY: GhosttyRowData = 8;-pub const GHOSTTY_ROW_DATA_MAX_VALUE: GhosttyRowData = 2147483647;-pub type GhosttyRowData = ::core::ffi::c_uint;-pub type GhosttyStyleId = u16;-pub const GHOSTTY_STYLE_COLOR_NONE: GhosttyStyleColorTag = 0;-pub const GHOSTTY_STYLE_COLOR_PALETTE: GhosttyStyleColorTag = 1;-pub const GHOSTTY_STYLE_COLOR_RGB: GhosttyStyleColorTag = 2;-pub const GHOSTTY_STYLE_COLOR_TAG_MAX_VALUE: GhosttyStyleColorTag = 2147483647;-pub type GhosttyStyleColorTag = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Copy, Clone)]-pub union GhosttyStyleColorValue {- pub palette: GhosttyColorPaletteIndex,- pub rgb: GhosttyColorRgb,-}-impl Default for GhosttyStyleColorValue {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttyStyleColor {- pub tag: u8,- pub value: GhosttyStyleColorValue,-}-impl Default for GhosttyStyleColor {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyStyleFlags = u16;-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttyStyle {- pub fg_color: GhosttyStyleColor,- pub bg_color: GhosttyStyleColor,- pub underline_color: GhosttyStyleColor,- pub flags: GhosttyStyleFlags,- pub reserved: u16,-}-impl Default for GhosttyStyle {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyGridRef {- pub node: *mut ::core::ffi::c_void,- pub x: u16,- pub y: u16,-}-impl Default for GhosttyGridRef {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyPointCoordinate {- pub x: u16,- pub y: u32,-}-pub const GHOSTTY_POINT_TAG_ACTIVE: GhosttyPointTag = 0;-pub const GHOSTTY_POINT_TAG_VIEWPORT: GhosttyPointTag = 1;-pub const GHOSTTY_POINT_TAG_SCREEN: GhosttyPointTag = 2;-pub const GHOSTTY_POINT_TAG_HISTORY: GhosttyPointTag = 3;-pub const GHOSTTY_POINT_TAG_MAX_VALUE: GhosttyPointTag = 2147483647;-pub type GhosttyPointTag = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Copy, Clone)]-pub union GhosttyPointValue {- pub coordinate: GhosttyPointCoordinate,- pub _padding: [u64; 2usize],-}-impl Default for GhosttyPointValue {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttyPoint {- pub tag: GhosttyPointTag,- pub value: GhosttyPointValue,-}-impl Default for GhosttyPoint {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySelectionGestureImpl {- _unused: [u8; 0],-}-pub type GhosttySelectionGesture = *mut GhosttySelectionGestureImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySelectionGestureEventImpl {- _unused: [u8; 0],-}-pub type GhosttySelectionGestureEvent = *mut GhosttySelectionGestureEventImpl;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySelection {- pub start: GhosttyGridRef,- pub end: GhosttyGridRef,- pub rectangle: bool,-}-impl Default for GhosttySelection {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySelectionBuffer {- pub ptr: *mut GhosttySelection,- pub cap: usize,- pub len: usize,-}-impl Default for GhosttySelectionBuffer {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalSelectWordOptions {- pub size: usize,- pub ref_: GhosttyGridRef,- pub boundary_codepoints: *const u32,- pub boundary_codepoints_len: usize,-}-impl Default for GhosttyTerminalSelectWordOptions {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalSelectWordBetweenOptions {- pub size: usize,- pub start: GhosttyGridRef,- pub end: GhosttyGridRef,- pub boundary_codepoints: *const u32,- pub boundary_codepoints_len: usize,-}-impl Default for GhosttyTerminalSelectWordBetweenOptions {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalSelectLineOptions {- pub size: usize,- pub ref_: GhosttyGridRef,- pub whitespace: *const u32,- pub whitespace_len: usize,- pub semantic_prompt_boundary: bool,-}-impl Default for GhosttyTerminalSelectLineOptions {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_SELECTION_ORDER_FORWARD: GhosttySelectionOrder = 0;-pub const GHOSTTY_SELECTION_ORDER_REVERSE: GhosttySelectionOrder = 1;-pub const GHOSTTY_SELECTION_ORDER_MIRRORED_FORWARD: GhosttySelectionOrder = 2;-pub const GHOSTTY_SELECTION_ORDER_MIRRORED_REVERSE: GhosttySelectionOrder = 3;-pub const GHOSTTY_SELECTION_ORDER_MAX_VALUE: GhosttySelectionOrder = 2147483647;-pub type GhosttySelectionOrder = ::core::ffi::c_uint;-pub const GHOSTTY_SELECTION_ADJUST_LEFT: GhosttySelectionAdjust = 0;-pub const GHOSTTY_SELECTION_ADJUST_RIGHT: GhosttySelectionAdjust = 1;-pub const GHOSTTY_SELECTION_ADJUST_UP: GhosttySelectionAdjust = 2;-pub const GHOSTTY_SELECTION_ADJUST_DOWN: GhosttySelectionAdjust = 3;-pub const GHOSTTY_SELECTION_ADJUST_HOME: GhosttySelectionAdjust = 4;-pub const GHOSTTY_SELECTION_ADJUST_END: GhosttySelectionAdjust = 5;-pub const GHOSTTY_SELECTION_ADJUST_PAGE_UP: GhosttySelectionAdjust = 6;-pub const GHOSTTY_SELECTION_ADJUST_PAGE_DOWN: GhosttySelectionAdjust = 7;-pub const GHOSTTY_SELECTION_ADJUST_BEGINNING_OF_LINE: GhosttySelectionAdjust = 8;-pub const GHOSTTY_SELECTION_ADJUST_END_OF_LINE: GhosttySelectionAdjust = 9;-pub const GHOSTTY_SELECTION_ADJUST_MAX_VALUE: GhosttySelectionAdjust = 2147483647;-pub type GhosttySelectionAdjust = ::core::ffi::c_uint;-pub const GHOSTTY_SELECTION_GESTURE_BEHAVIOR_CELL: GhosttySelectionGestureBehavior = 0;-pub const GHOSTTY_SELECTION_GESTURE_BEHAVIOR_WORD: GhosttySelectionGestureBehavior = 1;-pub const GHOSTTY_SELECTION_GESTURE_BEHAVIOR_LINE: GhosttySelectionGestureBehavior = 2;-pub const GHOSTTY_SELECTION_GESTURE_BEHAVIOR_OUTPUT: GhosttySelectionGestureBehavior = 3;-pub const GHOSTTY_SELECTION_GESTURE_BEHAVIOR_MAX_VALUE: GhosttySelectionGestureBehavior =- 2147483647;-pub type GhosttySelectionGestureBehavior = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySelectionGestureBehaviors {- pub single_click: GhosttySelectionGestureBehavior,- pub double_click: GhosttySelectionGestureBehavior,- pub triple_click: GhosttySelectionGestureBehavior,-}-impl Default for GhosttySelectionGestureBehaviors {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttySelectionGestureGeometry {- pub columns: u32,- pub cell_width: u32,- pub padding_left: u32,- pub screen_height: u32,-}-pub const GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_NONE: GhosttySelectionGestureAutoscroll = 0;-pub const GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_UP: GhosttySelectionGestureAutoscroll = 1;-pub const GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_DOWN: GhosttySelectionGestureAutoscroll = 2;-pub const GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_MAX_VALUE: GhosttySelectionGestureAutoscroll =- 2147483647;-pub type GhosttySelectionGestureAutoscroll = ::core::ffi::c_uint;-pub const GHOSTTY_SELECTION_GESTURE_DATA_INVALID: GhosttySelectionGestureData = 0;-pub const GHOSTTY_SELECTION_GESTURE_DATA_CLICK_COUNT: GhosttySelectionGestureData = 1;-pub const GHOSTTY_SELECTION_GESTURE_DATA_DRAGGED: GhosttySelectionGestureData = 2;-pub const GHOSTTY_SELECTION_GESTURE_DATA_AUTOSCROLL: GhosttySelectionGestureData = 3;-pub const GHOSTTY_SELECTION_GESTURE_DATA_BEHAVIOR: GhosttySelectionGestureData = 4;-pub const GHOSTTY_SELECTION_GESTURE_DATA_ANCHOR: GhosttySelectionGestureData = 5;-pub const GHOSTTY_SELECTION_GESTURE_DATA_MAX_VALUE: GhosttySelectionGestureData = 2147483647;-pub type GhosttySelectionGestureData = ::core::ffi::c_uint;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_PRESS: GhosttySelectionGestureEventType = 0;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_RELEASE: GhosttySelectionGestureEventType = 1;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_DRAG: GhosttySelectionGestureEventType = 2;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_AUTOSCROLL_TICK: GhosttySelectionGestureEventType =- 3;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_DEEP_PRESS: GhosttySelectionGestureEventType = 4;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_MAX_VALUE: GhosttySelectionGestureEventType =- 2147483647;-pub type GhosttySelectionGestureEventType = ::core::ffi::c_uint;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_INVALID: GhosttySelectionGestureEventOption = 0;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REF: GhosttySelectionGestureEventOption = 1;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_POSITION: GhosttySelectionGestureEventOption = 2;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REPEAT_DISTANCE: GhosttySelectionGestureEventOption =- 3;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_TIME_NS: GhosttySelectionGestureEventOption = 4;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REPEAT_INTERVAL_NS:- GhosttySelectionGestureEventOption = 5;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_WORD_BOUNDARY_CODEPOINTS:- GhosttySelectionGestureEventOption = 6;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_BEHAVIORS: GhosttySelectionGestureEventOption = 7;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_RECTANGLE: GhosttySelectionGestureEventOption = 8;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_GEOMETRY: GhosttySelectionGestureEventOption = 9;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_VIEWPORT: GhosttySelectionGestureEventOption = 10;-pub const GHOSTTY_SELECTION_GESTURE_EVENT_OPT_MAX_VALUE: GhosttySelectionGestureEventOption =- 2147483647;-pub type GhosttySelectionGestureEventOption = ::core::ffi::c_uint;-pub type GhosttyMode = u16;-pub const GHOSTTY_MODE_REPORT_NOT_RECOGNIZED: GhosttyModeReportState = 0;-pub const GHOSTTY_MODE_REPORT_SET: GhosttyModeReportState = 1;-pub const GHOSTTY_MODE_REPORT_RESET: GhosttyModeReportState = 2;-pub const GHOSTTY_MODE_REPORT_PERMANENTLY_SET: GhosttyModeReportState = 3;-pub const GHOSTTY_MODE_REPORT_PERMANENTLY_RESET: GhosttyModeReportState = 4;-pub const GHOSTTY_MODE_REPORT_MAX_VALUE: GhosttyModeReportState = 2147483647;-pub type GhosttyModeReportState = ::core::ffi::c_uint;-pub const GHOSTTY_OSC_COMMAND_INVALID: GhosttyOscCommandType = 0;-pub const GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE: GhosttyOscCommandType = 1;-pub const GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_ICON: GhosttyOscCommandType = 2;-pub const GHOSTTY_OSC_COMMAND_SEMANTIC_PROMPT: GhosttyOscCommandType = 3;-pub const GHOSTTY_OSC_COMMAND_CLIPBOARD_CONTENTS: GhosttyOscCommandType = 4;-pub const GHOSTTY_OSC_COMMAND_REPORT_PWD: GhosttyOscCommandType = 5;-pub const GHOSTTY_OSC_COMMAND_MOUSE_SHAPE: GhosttyOscCommandType = 6;-pub const GHOSTTY_OSC_COMMAND_COLOR_OPERATION: GhosttyOscCommandType = 7;-pub const GHOSTTY_OSC_COMMAND_KITTY_COLOR_PROTOCOL: GhosttyOscCommandType = 8;-pub const GHOSTTY_OSC_COMMAND_SHOW_DESKTOP_NOTIFICATION: GhosttyOscCommandType = 9;-pub const GHOSTTY_OSC_COMMAND_HYPERLINK_START: GhosttyOscCommandType = 10;-pub const GHOSTTY_OSC_COMMAND_HYPERLINK_END: GhosttyOscCommandType = 11;-pub const GHOSTTY_OSC_COMMAND_CONEMU_SLEEP: GhosttyOscCommandType = 12;-pub const GHOSTTY_OSC_COMMAND_CONEMU_SHOW_MESSAGE_BOX: GhosttyOscCommandType = 13;-pub const GHOSTTY_OSC_COMMAND_CONEMU_CHANGE_TAB_TITLE: GhosttyOscCommandType = 14;-pub const GHOSTTY_OSC_COMMAND_CONEMU_PROGRESS_REPORT: GhosttyOscCommandType = 15;-pub const GHOSTTY_OSC_COMMAND_CONEMU_WAIT_INPUT: GhosttyOscCommandType = 16;-pub const GHOSTTY_OSC_COMMAND_CONEMU_GUIMACRO: GhosttyOscCommandType = 17;-pub const GHOSTTY_OSC_COMMAND_CONEMU_RUN_PROCESS: GhosttyOscCommandType = 18;-pub const GHOSTTY_OSC_COMMAND_CONEMU_OUTPUT_ENVIRONMENT_VARIABLE: GhosttyOscCommandType = 19;-pub const GHOSTTY_OSC_COMMAND_CONEMU_XTERM_EMULATION: GhosttyOscCommandType = 20;-pub const GHOSTTY_OSC_COMMAND_CONEMU_COMMENT: GhosttyOscCommandType = 21;-pub const GHOSTTY_OSC_COMMAND_KITTY_TEXT_SIZING: GhosttyOscCommandType = 22;-pub const GHOSTTY_OSC_COMMAND_KITTY_CLIPBOARD_PROTOCOL: GhosttyOscCommandType = 23;-pub const GHOSTTY_OSC_COMMAND_KITTY_DND_PROTOCOL: GhosttyOscCommandType = 24;-pub const GHOSTTY_OSC_COMMAND_HIERARCHICAL_CONTEXT: GhosttyOscCommandType = 25;-pub const GHOSTTY_OSC_COMMAND_KITTY_DESKTOP_NOTIFICATION: GhosttyOscCommandType = 26;-pub const GHOSTTY_OSC_COMMAND_UNKNOWN: GhosttyOscCommandType = 27;-pub const GHOSTTY_OSC_COMMAND_PROGRAM_STATUS: GhosttyOscCommandType = 28;-pub const GHOSTTY_OSC_COMMAND_TYPE_MAX_VALUE: GhosttyOscCommandType = 2147483647;-pub type GhosttyOscCommandType = ::core::ffi::c_uint;-pub const GHOSTTY_OSC_TERMINATOR_ST: GhosttyOscTerminator = 0;-pub const GHOSTTY_OSC_TERMINATOR_BEL: GhosttyOscTerminator = 1;-pub const GHOSTTY_OSC_TERMINATOR_MAX_VALUE: GhosttyOscTerminator = 2147483647;-pub type GhosttyOscTerminator = ::core::ffi::c_uint;-pub const GHOSTTY_OSC_OPT_INVALID: GhosttyOscOption = 0;-pub const GHOSTTY_OSC_OPT_UNKNOWN_MAX_BYTES: GhosttyOscOption = 1;-pub const GHOSTTY_OSC_OPT_MAX_VALUE: GhosttyOscOption = 2147483647;-pub type GhosttyOscOption = ::core::ffi::c_uint;-pub const GHOSTTY_OSC_DATA_INVALID: GhosttyOscCommandData = 0;-pub const GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR: GhosttyOscCommandData = 1;-pub const GHOSTTY_OSC_DATA_UNKNOWN_CONTENT: GhosttyOscCommandData = 2;-pub const GHOSTTY_OSC_DATA_UNKNOWN_TRUNCATED: GhosttyOscCommandData = 3;-pub const GHOSTTY_OSC_DATA_UNKNOWN_TERMINATOR: GhosttyOscCommandData = 4;-pub const GHOSTTY_OSC_DATA_MAX_VALUE: GhosttyOscCommandData = 2147483647;-pub type GhosttyOscCommandData = ::core::ffi::c_uint;-pub const GHOSTTY_SIZE_REPORT_MODE_2048: GhosttySizeReportStyle = 0;-pub const GHOSTTY_SIZE_REPORT_CSI_14_T: GhosttySizeReportStyle = 1;-pub const GHOSTTY_SIZE_REPORT_CSI_16_T: GhosttySizeReportStyle = 2;-pub const GHOSTTY_SIZE_REPORT_CSI_18_T: GhosttySizeReportStyle = 3;-pub const GHOSTTY_SIZE_REPORT_CSI_19_T: GhosttySizeReportStyle = 4;-pub const GHOSTTY_SIZE_REPORT_STYLE_MAX_VALUE: GhosttySizeReportStyle = 2147483647;-pub type GhosttySizeReportStyle = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttySizeReportSize {- pub rows: u16,- pub columns: u16,- pub cell_width: u32,- pub cell_height: u32,-}-pub const GHOSTTY_KITTY_GRAPHICS_DATA_INVALID: GhosttyKittyGraphicsData = 0;-pub const GHOSTTY_KITTY_GRAPHICS_DATA_PLACEMENT_ITERATOR: GhosttyKittyGraphicsData = 1;-pub const GHOSTTY_KITTY_GRAPHICS_DATA_GENERATION: GhosttyKittyGraphicsData = 2;-pub const GHOSTTY_KITTY_GRAPHICS_DATA_MAX_VALUE: GhosttyKittyGraphicsData = 2147483647;-pub type GhosttyKittyGraphicsData = ::core::ffi::c_uint;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_INVALID: GhosttyKittyGraphicsPlacementData = 0;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_IMAGE_ID: GhosttyKittyGraphicsPlacementData = 1;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_PLACEMENT_ID: GhosttyKittyGraphicsPlacementData = 2;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_IS_VIRTUAL: GhosttyKittyGraphicsPlacementData = 3;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_X_OFFSET: GhosttyKittyGraphicsPlacementData = 4;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_Y_OFFSET: GhosttyKittyGraphicsPlacementData = 5;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_SOURCE_X: GhosttyKittyGraphicsPlacementData = 6;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_SOURCE_Y: GhosttyKittyGraphicsPlacementData = 7;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_SOURCE_WIDTH: GhosttyKittyGraphicsPlacementData = 8;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_SOURCE_HEIGHT: GhosttyKittyGraphicsPlacementData =- 9;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_COLUMNS: GhosttyKittyGraphicsPlacementData = 10;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_ROWS: GhosttyKittyGraphicsPlacementData = 11;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_Z: GhosttyKittyGraphicsPlacementData = 12;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_MAX_VALUE: GhosttyKittyGraphicsPlacementData =- 2147483647;-pub type GhosttyKittyGraphicsPlacementData = ::core::ffi::c_uint;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_ITERATOR_OPT_INVALID:- GhosttyKittyGraphicsPlacementIteratorOption = 0;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_ITERATOR_OPT_LAYER:- GhosttyKittyGraphicsPlacementIteratorOption = 1;-pub const GHOSTTY_KITTY_GRAPHICS_PLACEMENT_ITERATOR_OPT_MAX_VALUE:- GhosttyKittyGraphicsPlacementIteratorOption = 2147483647;-pub type GhosttyKittyGraphicsPlacementIteratorOption = ::core::ffi::c_uint;-pub const GHOSTTY_KITTY_IMAGE_FORMAT_RGB: GhosttyKittyImageFormat = 0;-pub const GHOSTTY_KITTY_IMAGE_FORMAT_RGBA: GhosttyKittyImageFormat = 1;-pub const GHOSTTY_KITTY_IMAGE_FORMAT_PNG: GhosttyKittyImageFormat = 2;-pub const GHOSTTY_KITTY_IMAGE_FORMAT_GRAY_ALPHA: GhosttyKittyImageFormat = 3;-pub const GHOSTTY_KITTY_IMAGE_FORMAT_GRAY: GhosttyKittyImageFormat = 4;-pub const GHOSTTY_KITTY_IMAGE_FORMAT_MAX_VALUE: GhosttyKittyImageFormat = 2147483647;-pub type GhosttyKittyImageFormat = ::core::ffi::c_uint;-pub const GHOSTTY_KITTY_IMAGE_COMPRESSION_NONE: GhosttyKittyImageCompression = 0;-pub const GHOSTTY_KITTY_IMAGE_COMPRESSION_ZLIB_DEFLATE: GhosttyKittyImageCompression = 1;-pub const GHOSTTY_KITTY_IMAGE_COMPRESSION_MAX_VALUE: GhosttyKittyImageCompression = 2147483647;-pub type GhosttyKittyImageCompression = ::core::ffi::c_uint;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_INVALID: GhosttyKittyGraphicsImageData = 0;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_ID: GhosttyKittyGraphicsImageData = 1;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_NUMBER: GhosttyKittyGraphicsImageData = 2;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_WIDTH: GhosttyKittyGraphicsImageData = 3;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_HEIGHT: GhosttyKittyGraphicsImageData = 4;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_FORMAT: GhosttyKittyGraphicsImageData = 5;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_COMPRESSION: GhosttyKittyGraphicsImageData = 6;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_PIXELS: GhosttyKittyGraphicsImageData = 7;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_EXPECTED_LEN: GhosttyKittyGraphicsImageData = 8;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_GENERATION: GhosttyKittyGraphicsImageData = 9;-pub const GHOSTTY_KITTY_GRAPHICS_IMAGE_DATA_MAX_VALUE: GhosttyKittyGraphicsImageData = 2147483647;-pub type GhosttyKittyGraphicsImageData = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyKittyGraphicsPlacementRenderInfo {- pub size: usize,- pub pixel_width: u32,- pub pixel_height: u32,- pub grid_cols: u32,- pub grid_rows: u32,- pub viewport_col: i32,- pub viewport_row: i32,- pub viewport_visible: bool,- pub source_x: u32,- pub source_y: u32,- pub source_width: u32,- pub source_height: u32,-}-pub const GHOSTTY_TERMINAL_COMPRESSION_MODE_INCREMENTAL: GhosttyTerminalCompressionMode = 0;-pub const GHOSTTY_TERMINAL_COMPRESSION_MODE_FULL: GhosttyTerminalCompressionMode = 1;-pub const GHOSTTY_TERMINAL_COMPRESSION_MODE_MAX_VALUE: GhosttyTerminalCompressionMode = 2147483647;-pub type GhosttyTerminalCompressionMode = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_COMPRESSION_RESULT_UNSUPPORTED: GhosttyTerminalCompressionResult = 0;-pub const GHOSTTY_TERMINAL_COMPRESSION_RESULT_PENDING: GhosttyTerminalCompressionResult = 1;-pub const GHOSTTY_TERMINAL_COMPRESSION_RESULT_COMPLETE: GhosttyTerminalCompressionResult = 2;-pub const GHOSTTY_TERMINAL_COMPRESSION_RESULT_MAX_VALUE: GhosttyTerminalCompressionResult =- 2147483647;-pub type GhosttyTerminalCompressionResult = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_SCROLL_VIEWPORT_TOP: GhosttyTerminalScrollViewportTag = 0;-pub const GHOSTTY_TERMINAL_SCROLL_VIEWPORT_BOTTOM: GhosttyTerminalScrollViewportTag = 1;-pub const GHOSTTY_TERMINAL_SCROLL_VIEWPORT_DELTA: GhosttyTerminalScrollViewportTag = 2;-pub const GHOSTTY_TERMINAL_SCROLL_VIEWPORT_ROW: GhosttyTerminalScrollViewportTag = 3;-pub const GHOSTTY_TERMINAL_SCROLL_VIEWPORT_DELTA_PROMPT: GhosttyTerminalScrollViewportTag = 4;-pub const GHOSTTY_TERMINAL_SCROLL_VIEWPORT_MAX_VALUE: GhosttyTerminalScrollViewportTag = 2147483647;-pub type GhosttyTerminalScrollViewportTag = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Copy, Clone)]-pub union GhosttyTerminalScrollViewportValue {- pub delta: isize,- pub row: usize,- pub delta_prompt: isize,- pub _padding: [u64; 2usize],-}-impl Default for GhosttyTerminalScrollViewportValue {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttyTerminalScrollViewport {- pub tag: GhosttyTerminalScrollViewportTag,- pub value: GhosttyTerminalScrollViewportValue,-}-impl Default for GhosttyTerminalScrollViewport {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_TERMINAL_SCREEN_PRIMARY: GhosttyTerminalScreen = 0;-pub const GHOSTTY_TERMINAL_SCREEN_ALTERNATE: GhosttyTerminalScreen = 1;-pub const GHOSTTY_TERMINAL_SCREEN_MAX_VALUE: GhosttyTerminalScreen = 2147483647;-pub type GhosttyTerminalScreen = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_BOUNDARY_GROUND: GhosttyTerminalBoundary = 1;-pub const GHOSTTY_TERMINAL_BOUNDARY_APC_START: GhosttyTerminalBoundary = 2;-pub const GHOSTTY_TERMINAL_BOUNDARY_APC_END: GhosttyTerminalBoundary = 4;-pub const GHOSTTY_TERMINAL_BOUNDARY_DCS_START: GhosttyTerminalBoundary = 8;-pub const GHOSTTY_TERMINAL_BOUNDARY_DCS_END: GhosttyTerminalBoundary = 16;-pub const GHOSTTY_TERMINAL_BOUNDARY_OSC_START: GhosttyTerminalBoundary = 32;-pub const GHOSTTY_TERMINAL_BOUNDARY_OSC_END: GhosttyTerminalBoundary = 64;-pub const GHOSTTY_TERMINAL_BOUNDARY_MAX_VALUE: GhosttyTerminalBoundary = 2147483647;-pub type GhosttyTerminalBoundary = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_STRING_KIND_APC: GhosttyTerminalStringKind = 0;-pub const GHOSTTY_TERMINAL_STRING_KIND_DCS: GhosttyTerminalStringKind = 1;-pub const GHOSTTY_TERMINAL_STRING_KIND_OSC: GhosttyTerminalStringKind = 2;-pub const GHOSTTY_TERMINAL_STRING_KIND_MAX_VALUE: GhosttyTerminalStringKind = 2147483647;-pub type GhosttyTerminalStringKind = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_STRING_INTRODUCER_ESC: GhosttyTerminalStringIntroducer = 0;-pub const GHOSTTY_TERMINAL_STRING_INTRODUCER_C1: GhosttyTerminalStringIntroducer = 1;-pub const GHOSTTY_TERMINAL_STRING_INTRODUCER_MAX_VALUE: GhosttyTerminalStringIntroducer =- 2147483647;-pub type GhosttyTerminalStringIntroducer = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_STRING_END_ST_ESC: GhosttyTerminalStringEnd = 0;-pub const GHOSTTY_TERMINAL_STRING_END_ST_C1: GhosttyTerminalStringEnd = 1;-pub const GHOSTTY_TERMINAL_STRING_END_CANCELLED: GhosttyTerminalStringEnd = 2;-pub const GHOSTTY_TERMINAL_STRING_END_ABORTED: GhosttyTerminalStringEnd = 3;-pub const GHOSTTY_TERMINAL_STRING_END_BEL: GhosttyTerminalStringEnd = 4;-pub const GHOSTTY_TERMINAL_STRING_END_MAX_VALUE: GhosttyTerminalStringEnd = 2147483647;-pub type GhosttyTerminalStringEnd = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalWriteStop {- pub size: usize,- pub consumed: usize,- pub reached: u32,- pub kind: GhosttyTerminalStringKind,- pub introducer: GhosttyTerminalStringIntroducer,- pub end: GhosttyTerminalStringEnd,- pub byte: u8,-}-impl Default for GhosttyTerminalWriteStop {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyTerminalScrollbar {- pub total: u64,- pub offset: u64,- pub len: u64,-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyTerminalMemoryUsage {- pub size: usize,- pub compression_supported: bool,- pub primary_pages: u64,- pub primary_virtual_bytes: u64,- pub primary_resident_bytes: u64,- pub primary_compressed_pages: u64,- pub primary_compressed_bytes: u64,- pub primary_image_bytes: u64,- pub alternate_pages: u64,- pub alternate_virtual_bytes: u64,- pub alternate_resident_bytes: u64,- pub alternate_compressed_pages: u64,- pub alternate_compressed_bytes: u64,- pub alternate_image_bytes: u64,-}-pub type GhosttyTerminalBellFn = ::core::option::Option<- unsafe extern "C" fn(terminal: GhosttyTerminal, userdata: *mut ::core::ffi::c_void),->;-pub const GHOSTTY_TERMINAL_UNKNOWN_SEQUENCE_APC: GhosttyTerminalUnknownSequenceTag = 0;-pub const GHOSTTY_TERMINAL_UNKNOWN_SEQUENCE_OSC: GhosttyTerminalUnknownSequenceTag = 1;-pub const GHOSTTY_TERMINAL_UNKNOWN_SEQUENCE_MAX_VALUE: GhosttyTerminalUnknownSequenceTag =- 2147483647;-pub type GhosttyTerminalUnknownSequenceTag = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalUnknownStringSequence {- pub truncated: bool,- pub content: GhosttyString,-}-impl Default for GhosttyTerminalUnknownStringSequence {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalUnknownOscSequence {- pub truncated: bool,- pub content: GhosttyString,- pub terminator: GhosttyOscTerminator,-}-impl Default for GhosttyTerminalUnknownOscSequence {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub union GhosttyTerminalUnknownSequenceValue {- pub apc: GhosttyTerminalUnknownStringSequence,- pub osc: GhosttyTerminalUnknownOscSequence,- pub _padding: [u64; 16usize],-}-impl Default for GhosttyTerminalUnknownSequenceValue {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttyTerminalUnknownSequence {- pub tag: GhosttyTerminalUnknownSequenceTag,- pub value: GhosttyTerminalUnknownSequenceValue,-}-impl Default for GhosttyTerminalUnknownSequence {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalUnknownSequenceFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- sequence: *const GhosttyTerminalUnknownSequence,- ),->;-pub const GHOSTTY_CLIPBOARD_LOCATION_STANDARD: GhosttyClipboardLocation = 0;-pub const GHOSTTY_CLIPBOARD_LOCATION_SELECTION: GhosttyClipboardLocation = 1;-pub const GHOSTTY_CLIPBOARD_LOCATION_PRIMARY: GhosttyClipboardLocation = 2;-pub const GHOSTTY_CLIPBOARD_LOCATION_MAX_VALUE: GhosttyClipboardLocation = 2147483647;-pub type GhosttyClipboardLocation = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyClipboardContent {- pub mime: GhosttyString,- pub data: GhosttyString,-}-impl Default for GhosttyClipboardContent {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_SUCCESS: GhosttyClipboardWriteResult = 0;-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_DENIED: GhosttyClipboardWriteResult = 1;-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_UNSUPPORTED: GhosttyClipboardWriteResult = 2;-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_BUSY: GhosttyClipboardWriteResult = 3;-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_INVALID_DATA: GhosttyClipboardWriteResult = 4;-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_IO_ERROR: GhosttyClipboardWriteResult = 5;-pub const GHOSTTY_CLIPBOARD_WRITE_RESULT_MAX_VALUE: GhosttyClipboardWriteResult = 2147483647;-pub type GhosttyClipboardWriteResult = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyClipboardWriteReply {- pub size: usize,- pub result: GhosttyClipboardWriteResult,- pub remember: bool,-}-impl Default for GhosttyClipboardWriteReply {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyClipboardWriteReplyFn = ::core::option::Option<- unsafe extern "C" fn(- write: *const GhosttyClipboardWrite,- reply: *const GhosttyClipboardWriteReply,- ),->;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyClipboardWrite {- pub location: GhosttyClipboardLocation,- pub contents: *const GhosttyClipboardContent,- pub contents_len: usize,- pub name: GhosttyString,- pub granted: bool,- pub can_remember: bool,- pub ctx: *const ::core::ffi::c_void,- pub reply: GhosttyClipboardWriteReplyFn,-}-impl Default for GhosttyClipboardWrite {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalClipboardWriteFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- write: *const GhosttyClipboardWrite,- ),->;-pub const GHOSTTY_CLIPBOARD_READ_RESULT_SUCCESS: GhosttyClipboardReadResult = 0;-pub const GHOSTTY_CLIPBOARD_READ_RESULT_DENIED: GhosttyClipboardReadResult = 1;-pub const GHOSTTY_CLIPBOARD_READ_RESULT_UNSUPPORTED: GhosttyClipboardReadResult = 2;-pub const GHOSTTY_CLIPBOARD_READ_RESULT_BUSY: GhosttyClipboardReadResult = 3;-pub const GHOSTTY_CLIPBOARD_READ_RESULT_IO_ERROR: GhosttyClipboardReadResult = 4;-pub const GHOSTTY_CLIPBOARD_READ_RESULT_MAX_VALUE: GhosttyClipboardReadResult = 2147483647;-pub type GhosttyClipboardReadResult = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyClipboardReadReply {- pub size: usize,- pub result: GhosttyClipboardReadResult,- pub contents: *const GhosttyClipboardContent,- pub contents_len: usize,- pub available: *const GhosttyString,- pub available_len: usize,- pub remember: bool,-}-impl Default for GhosttyClipboardReadReply {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyClipboardReadReplyFn = ::core::option::Option<- unsafe extern "C" fn(- read: *const GhosttyClipboardRead,- reply: *const GhosttyClipboardReadReply,- ),->;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyClipboardRead {- pub location: GhosttyClipboardLocation,- pub mimes: *const GhosttyString,- pub mimes_len: usize,- pub list: bool,- pub name: GhosttyString,- pub granted: bool,- pub can_remember: bool,- pub ctx: *const ::core::ffi::c_void,- pub reply: GhosttyClipboardReadReplyFn,-}-impl Default for GhosttyClipboardRead {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalClipboardReadFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- read: *const GhosttyClipboardRead,- ),->;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalDesktopNotification {- pub title: GhosttyString,- pub body: GhosttyString,-}-impl Default for GhosttyTerminalDesktopNotification {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalDesktopNotificationFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- notification: *const GhosttyTerminalDesktopNotification,- ),->;-pub const GHOSTTY_TERMINAL_PROGRESS_STATE_REMOVE: GhosttyTerminalProgressState = 0;-pub const GHOSTTY_TERMINAL_PROGRESS_STATE_SET: GhosttyTerminalProgressState = 1;-pub const GHOSTTY_TERMINAL_PROGRESS_STATE_ERROR: GhosttyTerminalProgressState = 2;-pub const GHOSTTY_TERMINAL_PROGRESS_STATE_INDETERMINATE: GhosttyTerminalProgressState = 3;-pub const GHOSTTY_TERMINAL_PROGRESS_STATE_PAUSE: GhosttyTerminalProgressState = 4;-pub const GHOSTTY_TERMINAL_PROGRESS_STATE_MAX_VALUE: GhosttyTerminalProgressState = 2147483647;-pub type GhosttyTerminalProgressState = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalProgressReport {- pub state: GhosttyTerminalProgressState,- pub progress: i8,-}-impl Default for GhosttyTerminalProgressReport {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalProgressReportFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- report: *const GhosttyTerminalProgressReport,- ),->;-pub const GHOSTTY_PROGRAM_STATUS_STATE_IDLE: GhosttyProgramStatusState = 0;-pub const GHOSTTY_PROGRAM_STATUS_STATE_WORKING: GhosttyProgramStatusState = 1;-pub const GHOSTTY_PROGRAM_STATUS_STATE_DONE: GhosttyProgramStatusState = 2;-pub const GHOSTTY_PROGRAM_STATUS_STATE_BLOCKED: GhosttyProgramStatusState = 3;-pub const GHOSTTY_PROGRAM_STATUS_STATE_ERROR: GhosttyProgramStatusState = 4;-pub const GHOSTTY_PROGRAM_STATUS_STATE_CLEAR: GhosttyProgramStatusState = 5;-pub const GHOSTTY_PROGRAM_STATUS_STATE_MAX_VALUE: GhosttyProgramStatusState = 2147483647;-pub type GhosttyProgramStatusState = ::core::ffi::c_uint;-pub const GHOSTTY_PROGRAM_STATUS_KIND_NONE: GhosttyProgramStatusKind = 0;-pub const GHOSTTY_PROGRAM_STATUS_KIND_PERMISSION: GhosttyProgramStatusKind = 1;-pub const GHOSTTY_PROGRAM_STATUS_KIND_QUESTION: GhosttyProgramStatusKind = 2;-pub const GHOSTTY_PROGRAM_STATUS_KIND_AUTH: GhosttyProgramStatusKind = 3;-pub const GHOSTTY_PROGRAM_STATUS_KIND_MAX_VALUE: GhosttyProgramStatusKind = 2147483647;-pub type GhosttyProgramStatusKind = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalProgramStatus {- pub state: GhosttyProgramStatusState,- pub kind: GhosttyProgramStatusKind,- pub progress: i8,- pub id: GhosttyString,- pub app: GhosttyString,- pub title: GhosttyString,- pub message: GhosttyString,-}-impl Default for GhosttyTerminalProgramStatus {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalProgramStatusFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- report: *const GhosttyTerminalProgramStatus,- ),->;-pub const GHOSTTY_SEMANTIC_PROMPT_INVALID: GhosttySemanticPromptKind = 0;-pub const GHOSTTY_SEMANTIC_PROMPT_PROMPT_START: GhosttySemanticPromptKind = 1;-pub const GHOSTTY_SEMANTIC_PROMPT_INPUT_START: GhosttySemanticPromptKind = 2;-pub const GHOSTTY_SEMANTIC_PROMPT_OUTPUT_START: GhosttySemanticPromptKind = 3;-pub const GHOSTTY_SEMANTIC_PROMPT_COMMAND_END: GhosttySemanticPromptKind = 4;-pub const GHOSTTY_SEMANTIC_PROMPT_MAX_VALUE: GhosttySemanticPromptKind = 2147483647;-pub type GhosttySemanticPromptKind = ::core::ffi::c_uint;-pub const GHOSTTY_SEMANTIC_PROMPT_PROMPT_PRIMARY: GhosttySemanticPromptPromptKind = 0;-pub const GHOSTTY_SEMANTIC_PROMPT_PROMPT_RIGHT: GhosttySemanticPromptPromptKind = 1;-pub const GHOSTTY_SEMANTIC_PROMPT_PROMPT_CONTINUATION: GhosttySemanticPromptPromptKind = 2;-pub const GHOSTTY_SEMANTIC_PROMPT_PROMPT_SECONDARY: GhosttySemanticPromptPromptKind = 3;-pub const GHOSTTY_SEMANTIC_PROMPT_PROMPT_MAX_VALUE: GhosttySemanticPromptPromptKind = 2147483647;-pub type GhosttySemanticPromptPromptKind = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyTerminalSemanticPrompt {- pub kind: GhosttySemanticPromptKind,- pub prompt_kind: GhosttySemanticPromptPromptKind,- pub has_exit_code: bool,- pub exit_code: i32,- pub command: GhosttyString,- pub error: GhosttyString,-}-impl Default for GhosttyTerminalSemanticPrompt {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalSemanticPromptFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- event: *const GhosttyTerminalSemanticPrompt,- ),->;-pub type GhosttyTerminalResetFn = ::core::option::Option<- unsafe extern "C" fn(terminal: GhosttyTerminal, userdata: *mut ::core::ffi::c_void),->;-pub const GHOSTTY_TERMINAL_RESIZE_WINDOW_GRID: GhosttyTerminalResizeWindowTag = 0;-pub const GHOSTTY_TERMINAL_RESIZE_WINDOW_MAX_VALUE: GhosttyTerminalResizeWindowTag = 2147483647;-pub type GhosttyTerminalResizeWindowTag = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyTerminalResizeWindowGrid {- pub rows: u16,- pub columns: u16,-}-#[repr(C)]-#[derive(Copy, Clone)]-pub union GhosttyTerminalResizeWindowValue {- pub grid: GhosttyTerminalResizeWindowGrid,- pub _padding: [u64; 2usize],-}-impl Default for GhosttyTerminalResizeWindowValue {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttyTerminalResizeWindow {- pub tag: GhosttyTerminalResizeWindowTag,- pub value: GhosttyTerminalResizeWindowValue,-}-impl Default for GhosttyTerminalResizeWindow {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub type GhosttyTerminalResizeWindowFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- request: *const GhosttyTerminalResizeWindow,- ),->;-pub type GhosttyTerminalColorSchemeFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- out_scheme: *mut GhosttyColorScheme,- ) -> bool,->;-pub type GhosttyTerminalDeviceAttributesFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- out_attrs: *mut GhosttyDeviceAttributes,- ) -> bool,->;-pub type GhosttyTerminalEnquiryFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- ) -> GhosttyString,->;-pub type GhosttyTerminalSizeFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- out_size: *mut GhosttySizeReportSize,- ) -> bool,->;-pub type GhosttyTerminalTitleChangedFn = ::core::option::Option<- unsafe extern "C" fn(terminal: GhosttyTerminal, userdata: *mut ::core::ffi::c_void),->;-pub type GhosttyTerminalRenderHoldFn = ::core::option::Option<- unsafe extern "C" fn(terminal: GhosttyTerminal, userdata: *mut ::core::ffi::c_void, held: bool),->;-pub type GhosttyTerminalPwdChangedFn = ::core::option::Option<- unsafe extern "C" fn(terminal: GhosttyTerminal, userdata: *mut ::core::ffi::c_void),->;-pub type GhosttyTerminalWritePtyFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- data: *const u8,- len: usize,- ),->;-pub type GhosttyTerminalXtversionFn = ::core::option::Option<- unsafe extern "C" fn(- terminal: GhosttyTerminal,- userdata: *mut ::core::ffi::c_void,- ) -> GhosttyString,->;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyTerminalModeConfig {- pub mode: GhosttyMode,- pub value: bool,-}-pub const GHOSTTY_TERMINAL_OPT_INVALID: GhosttyTerminalOption = 0;-pub const GHOSTTY_TERMINAL_OPT_USERDATA: GhosttyTerminalOption = 1;-pub const GHOSTTY_TERMINAL_OPT_WRITE_PTY: GhosttyTerminalOption = 2;-pub const GHOSTTY_TERMINAL_OPT_BELL: GhosttyTerminalOption = 3;-pub const GHOSTTY_TERMINAL_OPT_ENQUIRY: GhosttyTerminalOption = 4;-pub const GHOSTTY_TERMINAL_OPT_XTVERSION: GhosttyTerminalOption = 5;-pub const GHOSTTY_TERMINAL_OPT_TITLE_CHANGED: GhosttyTerminalOption = 6;-pub const GHOSTTY_TERMINAL_OPT_SIZE: GhosttyTerminalOption = 7;-pub const GHOSTTY_TERMINAL_OPT_COLOR_SCHEME: GhosttyTerminalOption = 8;-pub const GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES: GhosttyTerminalOption = 9;-pub const GHOSTTY_TERMINAL_OPT_TITLE: GhosttyTerminalOption = 10;-pub const GHOSTTY_TERMINAL_OPT_PWD: GhosttyTerminalOption = 11;-pub const GHOSTTY_TERMINAL_OPT_COLOR_FOREGROUND: GhosttyTerminalOption = 12;-pub const GHOSTTY_TERMINAL_OPT_COLOR_BACKGROUND: GhosttyTerminalOption = 13;-pub const GHOSTTY_TERMINAL_OPT_COLOR_CURSOR: GhosttyTerminalOption = 14;-pub const GHOSTTY_TERMINAL_OPT_COLOR_PALETTE: GhosttyTerminalOption = 15;-pub const GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_STORAGE_LIMIT: GhosttyTerminalOption = 16;-pub const GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_FILE: GhosttyTerminalOption = 17;-pub const GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_TEMP_FILE: GhosttyTerminalOption = 18;-pub const GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_SHARED_MEM: GhosttyTerminalOption = 19;-pub const GHOSTTY_TERMINAL_OPT_APC_MAX_BYTES: GhosttyTerminalOption = 20;-pub const GHOSTTY_TERMINAL_OPT_APC_MAX_BYTES_KITTY: GhosttyTerminalOption = 21;-pub const GHOSTTY_TERMINAL_OPT_SELECTION: GhosttyTerminalOption = 22;-pub const GHOSTTY_TERMINAL_OPT_DEFAULT_CURSOR_STYLE: GhosttyTerminalOption = 23;-pub const GHOSTTY_TERMINAL_OPT_DEFAULT_CURSOR_BLINK: GhosttyTerminalOption = 24;-pub const GHOSTTY_TERMINAL_OPT_GLYPH_PROTOCOL: GhosttyTerminalOption = 25;-pub const GHOSTTY_TERMINAL_OPT_PWD_CHANGED: GhosttyTerminalOption = 26;-pub const GHOSTTY_TERMINAL_OPT_CLIPBOARD_WRITE: GhosttyTerminalOption = 27;-pub const GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_BYTES: GhosttyTerminalOption = 28;-pub const GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_LINES: GhosttyTerminalOption = 29;-pub const GHOSTTY_TERMINAL_OPT_DESKTOP_NOTIFICATION: GhosttyTerminalOption = 30;-pub const GHOSTTY_TERMINAL_OPT_PROGRESS_REPORT: GhosttyTerminalOption = 31;-pub const GHOSTTY_TERMINAL_OPT_CONTINUATION_MAX_BYTES: GhosttyTerminalOption = 32;-pub const GHOSTTY_TERMINAL_OPT_TITLE_REPORT: GhosttyTerminalOption = 33;-pub const GHOSTTY_TERMINAL_OPT_MODE_DEFAULT: GhosttyTerminalOption = 34;-pub const GHOSTTY_TERMINAL_OPT_MODE: GhosttyTerminalOption = 35;-pub const GHOSTTY_TERMINAL_OPT_UNKNOWN_SEQUENCE: GhosttyTerminalOption = 36;-pub const GHOSTTY_TERMINAL_OPT_UNKNOWN_MAX_BYTES: GhosttyTerminalOption = 37;-pub const GHOSTTY_TERMINAL_OPT_TERMINFO_NAME: GhosttyTerminalOption = 38;-pub const GHOSTTY_TERMINAL_OPT_CLIPBOARD_READ: GhosttyTerminalOption = 39;-pub const GHOSTTY_TERMINAL_OPT_CLIPBOARD_WRITE_MAX_BYTES: GhosttyTerminalOption = 40;-pub const GHOSTTY_TERMINAL_OPT_RESIZE_PULL_SCROLLBACK: GhosttyTerminalOption = 41;-pub const GHOSTTY_TERMINAL_OPT_RENDER_HOLD: GhosttyTerminalOption = 42;-pub const GHOSTTY_TERMINAL_OPT_SEMANTIC_PROMPT: GhosttyTerminalOption = 43;-pub const GHOSTTY_TERMINAL_OPT_RESET: GhosttyTerminalOption = 44;-pub const GHOSTTY_TERMINAL_OPT_XT_CHECKSUM_REPORT: GhosttyTerminalOption = 45;-pub const GHOSTTY_TERMINAL_OPT_XT_CHECKSUM_EXTENSION: GhosttyTerminalOption = 46;-pub const GHOSTTY_TERMINAL_OPT_PROGRAM_STATUS: GhosttyTerminalOption = 47;-pub const GHOSTTY_TERMINAL_OPT_RESIZE_WINDOW: GhosttyTerminalOption = 48;-pub const GHOSTTY_TERMINAL_OPT_MAX_VALUE: GhosttyTerminalOption = 2147483647;-pub type GhosttyTerminalOption = ::core::ffi::c_uint;-pub const GHOSTTY_TERMINAL_DATA_INVALID: GhosttyTerminalData = 0;-pub const GHOSTTY_TERMINAL_DATA_COLS: GhosttyTerminalData = 1;-pub const GHOSTTY_TERMINAL_DATA_ROWS: GhosttyTerminalData = 2;-pub const GHOSTTY_TERMINAL_DATA_CURSOR_X: GhosttyTerminalData = 3;-pub const GHOSTTY_TERMINAL_DATA_CURSOR_Y: GhosttyTerminalData = 4;-pub const GHOSTTY_TERMINAL_DATA_CURSOR_PENDING_WRAP: GhosttyTerminalData = 5;-pub const GHOSTTY_TERMINAL_DATA_ACTIVE_SCREEN: GhosttyTerminalData = 6;-pub const GHOSTTY_TERMINAL_DATA_CURSOR_VISIBLE: GhosttyTerminalData = 7;-pub const GHOSTTY_TERMINAL_DATA_KITTY_KEYBOARD_FLAGS: GhosttyTerminalData = 8;-pub const GHOSTTY_TERMINAL_DATA_SCROLLBAR: GhosttyTerminalData = 9;-pub const GHOSTTY_TERMINAL_DATA_CURSOR_SGR_STYLE: GhosttyTerminalData = 10;-pub const GHOSTTY_TERMINAL_DATA_MOUSE_TRACKING: GhosttyTerminalData = 11;-pub const GHOSTTY_TERMINAL_DATA_TITLE: GhosttyTerminalData = 12;-pub const GHOSTTY_TERMINAL_DATA_PWD: GhosttyTerminalData = 13;-pub const GHOSTTY_TERMINAL_DATA_TOTAL_ROWS: GhosttyTerminalData = 14;-pub const GHOSTTY_TERMINAL_DATA_SCROLLBACK_ROWS: GhosttyTerminalData = 15;-pub const GHOSTTY_TERMINAL_DATA_WIDTH_PX: GhosttyTerminalData = 16;-pub const GHOSTTY_TERMINAL_DATA_HEIGHT_PX: GhosttyTerminalData = 17;-pub const GHOSTTY_TERMINAL_DATA_COLOR_FOREGROUND: GhosttyTerminalData = 18;-pub const GHOSTTY_TERMINAL_DATA_COLOR_BACKGROUND: GhosttyTerminalData = 19;-pub const GHOSTTY_TERMINAL_DATA_COLOR_CURSOR: GhosttyTerminalData = 20;-pub const GHOSTTY_TERMINAL_DATA_COLOR_PALETTE: GhosttyTerminalData = 21;-pub const GHOSTTY_TERMINAL_DATA_COLOR_FOREGROUND_DEFAULT: GhosttyTerminalData = 22;-pub const GHOSTTY_TERMINAL_DATA_COLOR_BACKGROUND_DEFAULT: GhosttyTerminalData = 23;-pub const GHOSTTY_TERMINAL_DATA_COLOR_CURSOR_DEFAULT: GhosttyTerminalData = 24;-pub const GHOSTTY_TERMINAL_DATA_COLOR_PALETTE_DEFAULT: GhosttyTerminalData = 25;-pub const GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_STORAGE_LIMIT: GhosttyTerminalData = 26;-pub const GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_MEDIUM_FILE: GhosttyTerminalData = 27;-pub const GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_MEDIUM_TEMP_FILE: GhosttyTerminalData = 28;-pub const GHOSTTY_TERMINAL_DATA_KITTY_IMAGE_MEDIUM_SHARED_MEM: GhosttyTerminalData = 29;-pub const GHOSTTY_TERMINAL_DATA_KITTY_GRAPHICS: GhosttyTerminalData = 30;-pub const GHOSTTY_TERMINAL_DATA_SELECTION: GhosttyTerminalData = 31;-pub const GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE: GhosttyTerminalData = 32;-pub const GHOSTTY_TERMINAL_DATA_VT_PROCESSING_ERROR: GhosttyTerminalData = 33;-pub const GHOSTTY_TERMINAL_DATA_SCROLLBACK_MAX_BYTES: GhosttyTerminalData = 34;-pub const GHOSTTY_TERMINAL_DATA_SCROLLBACK_MAX_LINES: GhosttyTerminalData = 35;-pub const GHOSTTY_TERMINAL_DATA_CONTINUATION_MAX_BYTES: GhosttyTerminalData = 36;-pub const GHOSTTY_TERMINAL_DATA_MODE: GhosttyTerminalData = 37;-pub const GHOSTTY_TERMINAL_DATA_VT_GROUND: GhosttyTerminalData = 38;-pub const GHOSTTY_TERMINAL_DATA_CURSOR_AT_PROMPT: GhosttyTerminalData = 39;-pub const GHOSTTY_TERMINAL_DATA_CLIPBOARD_WRITE_MAX_BYTES: GhosttyTerminalData = 40;-pub const GHOSTTY_TERMINAL_DATA_MOUSE_SHAPE: GhosttyTerminalData = 41;-pub const GHOSTTY_TERMINAL_DATA_MEMORY_USAGE: GhosttyTerminalData = 42;-pub const GHOSTTY_TERMINAL_DATA_MAX_VALUE: GhosttyTerminalData = 2147483647;-pub type GhosttyTerminalData = ::core::ffi::c_uint;-pub type GhosttyFormatterExtras = u32;-pub const GHOSTTY_FORMATTER_OPT_INVALID: GhosttyFormatterOption = 0;-pub const GHOSTTY_FORMATTER_OPT_EMIT: GhosttyFormatterOption = 1;-pub const GHOSTTY_FORMATTER_OPT_UNWRAP: GhosttyFormatterOption = 2;-pub const GHOSTTY_FORMATTER_OPT_TRIM: GhosttyFormatterOption = 3;-pub const GHOSTTY_FORMATTER_OPT_SELECTION: GhosttyFormatterOption = 4;-pub const GHOSTTY_FORMATTER_OPT_EXTRAS: GhosttyFormatterOption = 5;-pub const GHOSTTY_FORMATTER_OPT_MAX_VALUE: GhosttyFormatterOption = 2147483647;-pub type GhosttyFormatterOption = ::core::ffi::c_uint;-pub const GHOSTTY_RENDER_STATE_DIRTY_FALSE: GhosttyRenderStateDirty = 0;-pub const GHOSTTY_RENDER_STATE_DIRTY_PARTIAL: GhosttyRenderStateDirty = 1;-pub const GHOSTTY_RENDER_STATE_DIRTY_FULL: GhosttyRenderStateDirty = 2;-pub const GHOSTTY_RENDER_STATE_DIRTY_MAX_VALUE: GhosttyRenderStateDirty = 2147483647;-pub type GhosttyRenderStateDirty = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyRenderStateOverscan {- pub above: u16,- pub below: u16,-}-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyRenderStateRowId {- pub bits: [u64; 2usize],-}-pub const GHOSTTY_RENDER_STATE_DATA_INVALID: GhosttyRenderStateData = 0;-pub const GHOSTTY_RENDER_STATE_DATA_COLS: GhosttyRenderStateData = 1;-pub const GHOSTTY_RENDER_STATE_DATA_ROWS: GhosttyRenderStateData = 2;-pub const GHOSTTY_RENDER_STATE_DATA_DIRTY: GhosttyRenderStateData = 3;-pub const GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR: GhosttyRenderStateData = 4;-pub const GHOSTTY_RENDER_STATE_DATA_COLOR_BACKGROUND: GhosttyRenderStateData = 5;-pub const GHOSTTY_RENDER_STATE_DATA_COLOR_FOREGROUND: GhosttyRenderStateData = 6;-pub const GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR: GhosttyRenderStateData = 7;-pub const GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR_HAS_VALUE: GhosttyRenderStateData = 8;-pub const GHOSTTY_RENDER_STATE_DATA_COLOR_PALETTE: GhosttyRenderStateData = 9;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_VISUAL_STYLE: GhosttyRenderStateData = 10;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_VISIBLE: GhosttyRenderStateData = 11;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_BLINKING: GhosttyRenderStateData = 12;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_PASSWORD_INPUT: GhosttyRenderStateData = 13;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_HAS_VALUE: GhosttyRenderStateData = 14;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_X: GhosttyRenderStateData = 15;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_Y: GhosttyRenderStateData = 16;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_WIDE_TAIL: GhosttyRenderStateData = 17;-pub const GHOSTTY_RENDER_STATE_DATA_CURSOR: GhosttyRenderStateData = 18;-pub const GHOSTTY_RENDER_STATE_DATA_COLORS: GhosttyRenderStateData = 19;-pub const GHOSTTY_RENDER_STATE_DATA_OVERSCAN: GhosttyRenderStateData = 20;-pub const GHOSTTY_RENDER_STATE_DATA_OVERSCAN_REQUEST: GhosttyRenderStateData = 21;-pub const GHOSTTY_RENDER_STATE_DATA_IMAGE_ITERATOR: GhosttyRenderStateData = 22;-pub const GHOSTTY_RENDER_STATE_DATA_IMAGE_PLACEMENTS_GENERATION: GhosttyRenderStateData = 23;-pub const GHOSTTY_RENDER_STATE_DATA_MAX_VALUE: GhosttyRenderStateData = 2147483647;-pub type GhosttyRenderStateData = ::core::ffi::c_uint;-pub const GHOSTTY_RENDER_STATE_OPT_INVALID: GhosttyRenderStateOption = 0;-pub const GHOSTTY_RENDER_STATE_OPT_DIRTY: GhosttyRenderStateOption = 1;-pub const GHOSTTY_RENDER_STATE_OPT_OVERSCAN: GhosttyRenderStateOption = 2;-pub const GHOSTTY_RENDER_STATE_OPT_MAX_VALUE: GhosttyRenderStateOption = 2147483647;-pub type GhosttyRenderStateOption = ::core::ffi::c_uint;-pub const GHOSTTY_IMAGE_PROTOCOL_KITTY: GhosttyImageProtocol = 0;-pub const GHOSTTY_IMAGE_PROTOCOL_MAX_VALUE: GhosttyImageProtocol = 2147483647;-pub type GhosttyImageProtocol = ::core::ffi::c_uint;-pub const GHOSTTY_RENDER_STATE_KITTY_PLACEMENT_KIND_VIRTUAL: GhosttyRenderStateKittyPlacementKind =- 0;-pub const GHOSTTY_RENDER_STATE_KITTY_PLACEMENT_KIND_RELATIVE: GhosttyRenderStateKittyPlacementKind =- 1;-pub const GHOSTTY_RENDER_STATE_KITTY_PLACEMENT_KIND_FIXED: GhosttyRenderStateKittyPlacementKind = 2;-pub const GHOSTTY_RENDER_STATE_KITTY_PLACEMENT_KIND_MAX_VALUE:- GhosttyRenderStateKittyPlacementKind = 2147483647;-pub type GhosttyRenderStateKittyPlacementKind = ::core::ffi::c_uint;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_INVALID: GhosttyRenderStateImageData = 0;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_PROTOCOL: GhosttyRenderStateImageData = 1;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_IMAGE_ID: GhosttyRenderStateImageData = 2;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_IMAGE_GENERATION: GhosttyRenderStateImageData = 3;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_LAYER: GhosttyRenderStateImageData = 4;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_Z: GhosttyRenderStateImageData = 5;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_VIEWPORT_COL: GhosttyRenderStateImageData = 6;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_VIEWPORT_ROW: GhosttyRenderStateImageData = 7;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_GRID_COLS: GhosttyRenderStateImageData = 8;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_GRID_ROWS: GhosttyRenderStateImageData = 9;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_CELL_OFFSET_X: GhosttyRenderStateImageData = 10;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_CELL_OFFSET_Y: GhosttyRenderStateImageData = 11;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_PIXEL_WIDTH: GhosttyRenderStateImageData = 12;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_PIXEL_HEIGHT: GhosttyRenderStateImageData = 13;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_SOURCE_X: GhosttyRenderStateImageData = 14;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_SOURCE_Y: GhosttyRenderStateImageData = 15;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_SOURCE_WIDTH: GhosttyRenderStateImageData = 16;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_SOURCE_HEIGHT: GhosttyRenderStateImageData = 17;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_KITTY_PLACEMENT_ID: GhosttyRenderStateImageData = 18;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_KITTY_KIND: GhosttyRenderStateImageData = 19;-pub const GHOSTTY_RENDER_STATE_IMAGE_DATA_MAX_VALUE: GhosttyRenderStateImageData = 2147483647;-pub type GhosttyRenderStateImageData = ::core::ffi::c_uint;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_INVALID: GhosttyRenderStateRowData = 0;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_DIRTY: GhosttyRenderStateRowData = 1;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_RAW: GhosttyRenderStateRowData = 2;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_CELLS: GhosttyRenderStateRowData = 3;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_SELECTION: GhosttyRenderStateRowData = 4;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_CELLS_RAW: GhosttyRenderStateRowData = 5;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_VIEWPORT_Y: GhosttyRenderStateRowData = 6;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_ID: GhosttyRenderStateRowData = 7;-pub const GHOSTTY_RENDER_STATE_ROW_DATA_MAX_VALUE: GhosttyRenderStateRowData = 2147483647;-pub type GhosttyRenderStateRowData = ::core::ffi::c_uint;-pub const GHOSTTY_RENDER_STATE_ROW_OPT_INVALID: GhosttyRenderStateRowOption = 0;-pub const GHOSTTY_RENDER_STATE_ROW_OPT_DIRTY: GhosttyRenderStateRowOption = 1;-pub const GHOSTTY_RENDER_STATE_ROW_OPT_MAX_VALUE: GhosttyRenderStateRowOption = 2147483647;-pub type GhosttyRenderStateRowOption = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyRenderStateRowSelection {- pub size: usize,- pub start_x: u16,- pub end_x: u16,-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyRenderStateCursor {- pub size: usize,- pub viewport_has_value: bool,- pub viewport_x: u16,- pub viewport_y: u16,- pub wide_tail: bool,- pub visible: bool,- pub blinking: bool,- pub password_input: bool,- pub visual_style: GhosttyCursorStyle,-}-impl Default for GhosttyRenderStateCursor {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyRenderStateColors {- pub size: usize,- pub background: GhosttyColorRgb,- pub foreground: GhosttyColorRgb,- pub cursor: GhosttyColorRgb,- pub cursor_has_value: bool,- pub palette: [GhosttyColorRgb; 256usize],-}-impl Default for GhosttyRenderStateColors {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_INVALID: GhosttyRenderStateRowCellsData = 0;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_RAW: GhosttyRenderStateRowCellsData = 1;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_STYLE: GhosttyRenderStateRowCellsData = 2;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_LEN: GhosttyRenderStateRowCellsData = 3;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_BUF: GhosttyRenderStateRowCellsData = 4;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_BG_COLOR: GhosttyRenderStateRowCellsData = 5;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_FG_COLOR: GhosttyRenderStateRowCellsData = 6;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_SELECTED: GhosttyRenderStateRowCellsData = 7;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_HAS_STYLING: GhosttyRenderStateRowCellsData = 8;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_UTF8: GhosttyRenderStateRowCellsData = 9;-pub const GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_MAX_VALUE: GhosttyRenderStateRowCellsData =- 2147483647;-pub type GhosttyRenderStateRowCellsData = ::core::ffi::c_uint;-pub const GHOSTTY_SGR_ATTR_UNSET: GhosttySgrAttributeTag = 0;-pub const GHOSTTY_SGR_ATTR_UNKNOWN: GhosttySgrAttributeTag = 1;-pub const GHOSTTY_SGR_ATTR_BOLD: GhosttySgrAttributeTag = 2;-pub const GHOSTTY_SGR_ATTR_RESET_BOLD: GhosttySgrAttributeTag = 3;-pub const GHOSTTY_SGR_ATTR_ITALIC: GhosttySgrAttributeTag = 4;-pub const GHOSTTY_SGR_ATTR_RESET_ITALIC: GhosttySgrAttributeTag = 5;-pub const GHOSTTY_SGR_ATTR_FAINT: GhosttySgrAttributeTag = 6;-pub const GHOSTTY_SGR_ATTR_UNDERLINE: GhosttySgrAttributeTag = 7;-pub const GHOSTTY_SGR_ATTR_UNDERLINE_COLOR: GhosttySgrAttributeTag = 8;-pub const GHOSTTY_SGR_ATTR_UNDERLINE_COLOR_256: GhosttySgrAttributeTag = 9;-pub const GHOSTTY_SGR_ATTR_RESET_UNDERLINE_COLOR: GhosttySgrAttributeTag = 10;-pub const GHOSTTY_SGR_ATTR_OVERLINE: GhosttySgrAttributeTag = 11;-pub const GHOSTTY_SGR_ATTR_RESET_OVERLINE: GhosttySgrAttributeTag = 12;-pub const GHOSTTY_SGR_ATTR_BLINK: GhosttySgrAttributeTag = 13;-pub const GHOSTTY_SGR_ATTR_RESET_BLINK: GhosttySgrAttributeTag = 14;-pub const GHOSTTY_SGR_ATTR_INVERSE: GhosttySgrAttributeTag = 15;-pub const GHOSTTY_SGR_ATTR_RESET_INVERSE: GhosttySgrAttributeTag = 16;-pub const GHOSTTY_SGR_ATTR_INVISIBLE: GhosttySgrAttributeTag = 17;-pub const GHOSTTY_SGR_ATTR_RESET_INVISIBLE: GhosttySgrAttributeTag = 18;-pub const GHOSTTY_SGR_ATTR_STRIKETHROUGH: GhosttySgrAttributeTag = 19;-pub const GHOSTTY_SGR_ATTR_RESET_STRIKETHROUGH: GhosttySgrAttributeTag = 20;-pub const GHOSTTY_SGR_ATTR_DIRECT_COLOR_FG: GhosttySgrAttributeTag = 21;-pub const GHOSTTY_SGR_ATTR_DIRECT_COLOR_BG: GhosttySgrAttributeTag = 22;-pub const GHOSTTY_SGR_ATTR_BG_8: GhosttySgrAttributeTag = 23;-pub const GHOSTTY_SGR_ATTR_FG_8: GhosttySgrAttributeTag = 24;-pub const GHOSTTY_SGR_ATTR_RESET_FG: GhosttySgrAttributeTag = 25;-pub const GHOSTTY_SGR_ATTR_RESET_BG: GhosttySgrAttributeTag = 26;-pub const GHOSTTY_SGR_ATTR_BRIGHT_BG_8: GhosttySgrAttributeTag = 27;-pub const GHOSTTY_SGR_ATTR_BRIGHT_FG_8: GhosttySgrAttributeTag = 28;-pub const GHOSTTY_SGR_ATTR_BG_256: GhosttySgrAttributeTag = 29;-pub const GHOSTTY_SGR_ATTR_FG_256: GhosttySgrAttributeTag = 30;-pub const GHOSTTY_SGR_ATTR_MAX_VALUE: GhosttySgrAttributeTag = 2147483647;-pub type GhosttySgrAttributeTag = ::core::ffi::c_uint;-pub const GHOSTTY_SGR_UNDERLINE_NONE: GhosttySgrUnderline = 0;-pub const GHOSTTY_SGR_UNDERLINE_SINGLE: GhosttySgrUnderline = 1;-pub const GHOSTTY_SGR_UNDERLINE_DOUBLE: GhosttySgrUnderline = 2;-pub const GHOSTTY_SGR_UNDERLINE_CURLY: GhosttySgrUnderline = 3;-pub const GHOSTTY_SGR_UNDERLINE_DOTTED: GhosttySgrUnderline = 4;-pub const GHOSTTY_SGR_UNDERLINE_DASHED: GhosttySgrUnderline = 5;-pub const GHOSTTY_SGR_UNDERLINE_MAX_VALUE: GhosttySgrUnderline = 2147483647;-pub type GhosttySgrUnderline = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySgrUnknown {- pub full_ptr: *const u16,- pub full_len: usize,- pub partial_ptr: *const u16,- pub partial_len: usize,-}-impl Default for GhosttySgrUnknown {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub union GhosttySgrAttributeValue {- pub unknown: GhosttySgrUnknown,- pub underline: GhosttySgrUnderline,- pub underline_color: GhosttyColorRgb,- pub underline_color_256: GhosttyColorPaletteIndex,- pub direct_color_fg: GhosttyColorRgb,- pub direct_color_bg: GhosttyColorRgb,- pub bg_8: GhosttyColorPaletteIndex,- pub fg_8: GhosttyColorPaletteIndex,- pub bright_bg_8: GhosttyColorPaletteIndex,- pub bright_fg_8: GhosttyColorPaletteIndex,- pub bg_256: GhosttyColorPaletteIndex,- pub fg_256: GhosttyColorPaletteIndex,- pub _padding: [u64; 8usize],-}-impl Default for GhosttySgrAttributeValue {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Copy, Clone)]-pub struct GhosttySgrAttribute {- pub tag: GhosttySgrAttributeTag,- pub value: GhosttySgrAttributeValue,-}-impl Default for GhosttySgrAttribute {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttySysImage {- pub width: u32,- pub height: u32,- pub data: *mut u8,- pub data_len: usize,-}-impl Default for GhosttySysImage {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_SYS_LOG_LEVEL_ERROR: GhosttySysLogLevel = 0;-pub const GHOSTTY_SYS_LOG_LEVEL_WARNING: GhosttySysLogLevel = 1;-pub const GHOSTTY_SYS_LOG_LEVEL_INFO: GhosttySysLogLevel = 2;-pub const GHOSTTY_SYS_LOG_LEVEL_DEBUG: GhosttySysLogLevel = 3;-pub const GHOSTTY_SYS_LOG_LEVEL_MAX_VALUE: GhosttySysLogLevel = 2147483647;-pub type GhosttySysLogLevel = ::core::ffi::c_uint;-pub type GhosttySysLogFn = ::core::option::Option<- unsafe extern "C" fn(- userdata: *mut ::core::ffi::c_void,- level: GhosttySysLogLevel,- scope: *const u8,- scope_len: usize,- message: *const u8,- message_len: usize,- ),->;-pub type GhosttySysDecodePngFn = ::core::option::Option<- unsafe extern "C" fn(- userdata: *mut ::core::ffi::c_void,- allocator: *const GhosttyAllocator,- data: *const u8,- data_len: usize,- out: *mut GhosttySysImage,- ) -> bool,->;-pub type GhosttySysRandomSecureFn = ::core::option::Option<- unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void, buf: *mut u8, len: usize) -> bool,->;-pub const GHOSTTY_SYS_OPT_INVALID: GhosttySysOption = 0;-pub const GHOSTTY_SYS_OPT_USERDATA: GhosttySysOption = 1;-pub const GHOSTTY_SYS_OPT_DECODE_PNG: GhosttySysOption = 2;-pub const GHOSTTY_SYS_OPT_LOG: GhosttySysOption = 3;-pub const GHOSTTY_SYS_OPT_RANDOM_SECURE: GhosttySysOption = 4;-pub const GHOSTTY_SYS_OPT_MAX_VALUE: GhosttySysOption = 2147483647;-pub type GhosttySysOption = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyKeyEventImpl {- _unused: [u8; 0],-}-pub type GhosttyKeyEvent = *mut GhosttyKeyEventImpl;-pub const GHOSTTY_KEY_ACTION_RELEASE: GhosttyKeyAction = 0;-pub const GHOSTTY_KEY_ACTION_PRESS: GhosttyKeyAction = 1;-pub const GHOSTTY_KEY_ACTION_REPEAT: GhosttyKeyAction = 2;-pub const GHOSTTY_KEY_ACTION_MAX_VALUE: GhosttyKeyAction = 2147483647;-pub type GhosttyKeyAction = ::core::ffi::c_uint;-pub type GhosttyMods = u16;-pub const GHOSTTY_KEY_UNIDENTIFIED: GhosttyKey = 0;-pub const GHOSTTY_KEY_BACKQUOTE: GhosttyKey = 1;-pub const GHOSTTY_KEY_BACKSLASH: GhosttyKey = 2;-pub const GHOSTTY_KEY_BRACKET_LEFT: GhosttyKey = 3;-pub const GHOSTTY_KEY_BRACKET_RIGHT: GhosttyKey = 4;-pub const GHOSTTY_KEY_COMMA: GhosttyKey = 5;-pub const GHOSTTY_KEY_DIGIT_0: GhosttyKey = 6;-pub const GHOSTTY_KEY_DIGIT_1: GhosttyKey = 7;-pub const GHOSTTY_KEY_DIGIT_2: GhosttyKey = 8;-pub const GHOSTTY_KEY_DIGIT_3: GhosttyKey = 9;-pub const GHOSTTY_KEY_DIGIT_4: GhosttyKey = 10;-pub const GHOSTTY_KEY_DIGIT_5: GhosttyKey = 11;-pub const GHOSTTY_KEY_DIGIT_6: GhosttyKey = 12;-pub const GHOSTTY_KEY_DIGIT_7: GhosttyKey = 13;-pub const GHOSTTY_KEY_DIGIT_8: GhosttyKey = 14;-pub const GHOSTTY_KEY_DIGIT_9: GhosttyKey = 15;-pub const GHOSTTY_KEY_EQUAL: GhosttyKey = 16;-pub const GHOSTTY_KEY_INTL_BACKSLASH: GhosttyKey = 17;-pub const GHOSTTY_KEY_INTL_RO: GhosttyKey = 18;-pub const GHOSTTY_KEY_INTL_YEN: GhosttyKey = 19;-pub const GHOSTTY_KEY_A: GhosttyKey = 20;-pub const GHOSTTY_KEY_B: GhosttyKey = 21;-pub const GHOSTTY_KEY_C: GhosttyKey = 22;-pub const GHOSTTY_KEY_D: GhosttyKey = 23;-pub const GHOSTTY_KEY_E: GhosttyKey = 24;-pub const GHOSTTY_KEY_F: GhosttyKey = 25;-pub const GHOSTTY_KEY_G: GhosttyKey = 26;-pub const GHOSTTY_KEY_H: GhosttyKey = 27;-pub const GHOSTTY_KEY_I: GhosttyKey = 28;-pub const GHOSTTY_KEY_J: GhosttyKey = 29;-pub const GHOSTTY_KEY_K: GhosttyKey = 30;-pub const GHOSTTY_KEY_L: GhosttyKey = 31;-pub const GHOSTTY_KEY_M: GhosttyKey = 32;-pub const GHOSTTY_KEY_N: GhosttyKey = 33;-pub const GHOSTTY_KEY_O: GhosttyKey = 34;-pub const GHOSTTY_KEY_P: GhosttyKey = 35;-pub const GHOSTTY_KEY_Q: GhosttyKey = 36;-pub const GHOSTTY_KEY_R: GhosttyKey = 37;-pub const GHOSTTY_KEY_S: GhosttyKey = 38;-pub const GHOSTTY_KEY_T: GhosttyKey = 39;-pub const GHOSTTY_KEY_U: GhosttyKey = 40;-pub const GHOSTTY_KEY_V: GhosttyKey = 41;-pub const GHOSTTY_KEY_W: GhosttyKey = 42;-pub const GHOSTTY_KEY_X: GhosttyKey = 43;-pub const GHOSTTY_KEY_Y: GhosttyKey = 44;-pub const GHOSTTY_KEY_Z: GhosttyKey = 45;-pub const GHOSTTY_KEY_MINUS: GhosttyKey = 46;-pub const GHOSTTY_KEY_PERIOD: GhosttyKey = 47;-pub const GHOSTTY_KEY_QUOTE: GhosttyKey = 48;-pub const GHOSTTY_KEY_SEMICOLON: GhosttyKey = 49;-pub const GHOSTTY_KEY_SLASH: GhosttyKey = 50;-pub const GHOSTTY_KEY_ALT_LEFT: GhosttyKey = 51;-pub const GHOSTTY_KEY_ALT_RIGHT: GhosttyKey = 52;-pub const GHOSTTY_KEY_BACKSPACE: GhosttyKey = 53;-pub const GHOSTTY_KEY_CAPS_LOCK: GhosttyKey = 54;-pub const GHOSTTY_KEY_CONTEXT_MENU: GhosttyKey = 55;-pub const GHOSTTY_KEY_CONTROL_LEFT: GhosttyKey = 56;-pub const GHOSTTY_KEY_CONTROL_RIGHT: GhosttyKey = 57;-pub const GHOSTTY_KEY_ENTER: GhosttyKey = 58;-pub const GHOSTTY_KEY_META_LEFT: GhosttyKey = 59;-pub const GHOSTTY_KEY_META_RIGHT: GhosttyKey = 60;-pub const GHOSTTY_KEY_SHIFT_LEFT: GhosttyKey = 61;-pub const GHOSTTY_KEY_SHIFT_RIGHT: GhosttyKey = 62;-pub const GHOSTTY_KEY_SPACE: GhosttyKey = 63;-pub const GHOSTTY_KEY_TAB: GhosttyKey = 64;-pub const GHOSTTY_KEY_CONVERT: GhosttyKey = 65;-pub const GHOSTTY_KEY_KANA_MODE: GhosttyKey = 66;-pub const GHOSTTY_KEY_NON_CONVERT: GhosttyKey = 67;-pub const GHOSTTY_KEY_DELETE: GhosttyKey = 68;-pub const GHOSTTY_KEY_END: GhosttyKey = 69;-pub const GHOSTTY_KEY_HELP: GhosttyKey = 70;-pub const GHOSTTY_KEY_HOME: GhosttyKey = 71;-pub const GHOSTTY_KEY_INSERT: GhosttyKey = 72;-pub const GHOSTTY_KEY_PAGE_DOWN: GhosttyKey = 73;-pub const GHOSTTY_KEY_PAGE_UP: GhosttyKey = 74;-pub const GHOSTTY_KEY_ARROW_DOWN: GhosttyKey = 75;-pub const GHOSTTY_KEY_ARROW_LEFT: GhosttyKey = 76;-pub const GHOSTTY_KEY_ARROW_RIGHT: GhosttyKey = 77;-pub const GHOSTTY_KEY_ARROW_UP: GhosttyKey = 78;-pub const GHOSTTY_KEY_NUM_LOCK: GhosttyKey = 79;-pub const GHOSTTY_KEY_NUMPAD_0: GhosttyKey = 80;-pub const GHOSTTY_KEY_NUMPAD_1: GhosttyKey = 81;-pub const GHOSTTY_KEY_NUMPAD_2: GhosttyKey = 82;-pub const GHOSTTY_KEY_NUMPAD_3: GhosttyKey = 83;-pub const GHOSTTY_KEY_NUMPAD_4: GhosttyKey = 84;-pub const GHOSTTY_KEY_NUMPAD_5: GhosttyKey = 85;-pub const GHOSTTY_KEY_NUMPAD_6: GhosttyKey = 86;-pub const GHOSTTY_KEY_NUMPAD_7: GhosttyKey = 87;-pub const GHOSTTY_KEY_NUMPAD_8: GhosttyKey = 88;-pub const GHOSTTY_KEY_NUMPAD_9: GhosttyKey = 89;-pub const GHOSTTY_KEY_NUMPAD_ADD: GhosttyKey = 90;-pub const GHOSTTY_KEY_NUMPAD_BACKSPACE: GhosttyKey = 91;-pub const GHOSTTY_KEY_NUMPAD_CLEAR: GhosttyKey = 92;-pub const GHOSTTY_KEY_NUMPAD_CLEAR_ENTRY: GhosttyKey = 93;-pub const GHOSTTY_KEY_NUMPAD_COMMA: GhosttyKey = 94;-pub const GHOSTTY_KEY_NUMPAD_DECIMAL: GhosttyKey = 95;-pub const GHOSTTY_KEY_NUMPAD_DIVIDE: GhosttyKey = 96;-pub const GHOSTTY_KEY_NUMPAD_ENTER: GhosttyKey = 97;-pub const GHOSTTY_KEY_NUMPAD_EQUAL: GhosttyKey = 98;-pub const GHOSTTY_KEY_NUMPAD_MEMORY_ADD: GhosttyKey = 99;-pub const GHOSTTY_KEY_NUMPAD_MEMORY_CLEAR: GhosttyKey = 100;-pub const GHOSTTY_KEY_NUMPAD_MEMORY_RECALL: GhosttyKey = 101;-pub const GHOSTTY_KEY_NUMPAD_MEMORY_STORE: GhosttyKey = 102;-pub const GHOSTTY_KEY_NUMPAD_MEMORY_SUBTRACT: GhosttyKey = 103;-pub const GHOSTTY_KEY_NUMPAD_MULTIPLY: GhosttyKey = 104;-pub const GHOSTTY_KEY_NUMPAD_PAREN_LEFT: GhosttyKey = 105;-pub const GHOSTTY_KEY_NUMPAD_PAREN_RIGHT: GhosttyKey = 106;-pub const GHOSTTY_KEY_NUMPAD_SUBTRACT: GhosttyKey = 107;-pub const GHOSTTY_KEY_NUMPAD_SEPARATOR: GhosttyKey = 108;-pub const GHOSTTY_KEY_NUMPAD_UP: GhosttyKey = 109;-pub const GHOSTTY_KEY_NUMPAD_DOWN: GhosttyKey = 110;-pub const GHOSTTY_KEY_NUMPAD_RIGHT: GhosttyKey = 111;-pub const GHOSTTY_KEY_NUMPAD_LEFT: GhosttyKey = 112;-pub const GHOSTTY_KEY_NUMPAD_BEGIN: GhosttyKey = 113;-pub const GHOSTTY_KEY_NUMPAD_HOME: GhosttyKey = 114;-pub const GHOSTTY_KEY_NUMPAD_END: GhosttyKey = 115;-pub const GHOSTTY_KEY_NUMPAD_INSERT: GhosttyKey = 116;-pub const GHOSTTY_KEY_NUMPAD_DELETE: GhosttyKey = 117;-pub const GHOSTTY_KEY_NUMPAD_PAGE_UP: GhosttyKey = 118;-pub const GHOSTTY_KEY_NUMPAD_PAGE_DOWN: GhosttyKey = 119;-pub const GHOSTTY_KEY_ESCAPE: GhosttyKey = 120;-pub const GHOSTTY_KEY_F1: GhosttyKey = 121;-pub const GHOSTTY_KEY_F2: GhosttyKey = 122;-pub const GHOSTTY_KEY_F3: GhosttyKey = 123;-pub const GHOSTTY_KEY_F4: GhosttyKey = 124;-pub const GHOSTTY_KEY_F5: GhosttyKey = 125;-pub const GHOSTTY_KEY_F6: GhosttyKey = 126;-pub const GHOSTTY_KEY_F7: GhosttyKey = 127;-pub const GHOSTTY_KEY_F8: GhosttyKey = 128;-pub const GHOSTTY_KEY_F9: GhosttyKey = 129;-pub const GHOSTTY_KEY_F10: GhosttyKey = 130;-pub const GHOSTTY_KEY_F11: GhosttyKey = 131;-pub const GHOSTTY_KEY_F12: GhosttyKey = 132;-pub const GHOSTTY_KEY_F13: GhosttyKey = 133;-pub const GHOSTTY_KEY_F14: GhosttyKey = 134;-pub const GHOSTTY_KEY_F15: GhosttyKey = 135;-pub const GHOSTTY_KEY_F16: GhosttyKey = 136;-pub const GHOSTTY_KEY_F17: GhosttyKey = 137;-pub const GHOSTTY_KEY_F18: GhosttyKey = 138;-pub const GHOSTTY_KEY_F19: GhosttyKey = 139;-pub const GHOSTTY_KEY_F20: GhosttyKey = 140;-pub const GHOSTTY_KEY_F21: GhosttyKey = 141;-pub const GHOSTTY_KEY_F22: GhosttyKey = 142;-pub const GHOSTTY_KEY_F23: GhosttyKey = 143;-pub const GHOSTTY_KEY_F24: GhosttyKey = 144;-pub const GHOSTTY_KEY_F25: GhosttyKey = 145;-pub const GHOSTTY_KEY_FN: GhosttyKey = 146;-pub const GHOSTTY_KEY_FN_LOCK: GhosttyKey = 147;-pub const GHOSTTY_KEY_PRINT_SCREEN: GhosttyKey = 148;-pub const GHOSTTY_KEY_SCROLL_LOCK: GhosttyKey = 149;-pub const GHOSTTY_KEY_PAUSE: GhosttyKey = 150;-pub const GHOSTTY_KEY_BROWSER_BACK: GhosttyKey = 151;-pub const GHOSTTY_KEY_BROWSER_FAVORITES: GhosttyKey = 152;-pub const GHOSTTY_KEY_BROWSER_FORWARD: GhosttyKey = 153;-pub const GHOSTTY_KEY_BROWSER_HOME: GhosttyKey = 154;-pub const GHOSTTY_KEY_BROWSER_REFRESH: GhosttyKey = 155;-pub const GHOSTTY_KEY_BROWSER_SEARCH: GhosttyKey = 156;-pub const GHOSTTY_KEY_BROWSER_STOP: GhosttyKey = 157;-pub const GHOSTTY_KEY_EJECT: GhosttyKey = 158;-pub const GHOSTTY_KEY_LAUNCH_APP_1: GhosttyKey = 159;-pub const GHOSTTY_KEY_LAUNCH_APP_2: GhosttyKey = 160;-pub const GHOSTTY_KEY_LAUNCH_MAIL: GhosttyKey = 161;-pub const GHOSTTY_KEY_MEDIA_PLAY_PAUSE: GhosttyKey = 162;-pub const GHOSTTY_KEY_MEDIA_SELECT: GhosttyKey = 163;-pub const GHOSTTY_KEY_MEDIA_STOP: GhosttyKey = 164;-pub const GHOSTTY_KEY_MEDIA_TRACK_NEXT: GhosttyKey = 165;-pub const GHOSTTY_KEY_MEDIA_TRACK_PREVIOUS: GhosttyKey = 166;-pub const GHOSTTY_KEY_POWER: GhosttyKey = 167;-pub const GHOSTTY_KEY_SLEEP: GhosttyKey = 168;-pub const GHOSTTY_KEY_AUDIO_VOLUME_DOWN: GhosttyKey = 169;-pub const GHOSTTY_KEY_AUDIO_VOLUME_MUTE: GhosttyKey = 170;-pub const GHOSTTY_KEY_AUDIO_VOLUME_UP: GhosttyKey = 171;-pub const GHOSTTY_KEY_WAKE_UP: GhosttyKey = 172;-pub const GHOSTTY_KEY_COPY: GhosttyKey = 173;-pub const GHOSTTY_KEY_CUT: GhosttyKey = 174;-pub const GHOSTTY_KEY_PASTE: GhosttyKey = 175;-pub const GHOSTTY_KEY_MAX_VALUE: GhosttyKey = 2147483647;-pub type GhosttyKey = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyKeyEncoderImpl {- _unused: [u8; 0],-}-pub type GhosttyKeyEncoder = *mut GhosttyKeyEncoderImpl;-pub type GhosttyKittyKeyFlags = u8;-pub const GHOSTTY_OPTION_AS_ALT_FALSE: GhosttyOptionAsAlt = 0;-pub const GHOSTTY_OPTION_AS_ALT_TRUE: GhosttyOptionAsAlt = 1;-pub const GHOSTTY_OPTION_AS_ALT_LEFT: GhosttyOptionAsAlt = 2;-pub const GHOSTTY_OPTION_AS_ALT_RIGHT: GhosttyOptionAsAlt = 3;-pub const GHOSTTY_OPTION_AS_ALT_MAX_VALUE: GhosttyOptionAsAlt = 2147483647;-pub type GhosttyOptionAsAlt = ::core::ffi::c_uint;-pub const GHOSTTY_KEY_ENCODER_OPT_INVALID: GhosttyKeyEncoderOption = 0;-pub const GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION: GhosttyKeyEncoderOption = 1;-pub const GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION: GhosttyKeyEncoderOption = 2;-pub const GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK: GhosttyKeyEncoderOption = 3;-pub const GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX: GhosttyKeyEncoderOption = 4;-pub const GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2: GhosttyKeyEncoderOption = 5;-pub const GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS: GhosttyKeyEncoderOption = 6;-pub const GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT: GhosttyKeyEncoderOption = 7;-pub const GHOSTTY_KEY_ENCODER_OPT_BACKARROW_KEY_MODE: GhosttyKeyEncoderOption = 8;-pub const GHOSTTY_KEY_ENCODER_OPT_MAX_VALUE: GhosttyKeyEncoderOption = 2147483647;-pub type GhosttyKeyEncoderOption = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyMouseEventImpl {- _unused: [u8; 0],-}-pub type GhosttyMouseEvent = *mut GhosttyMouseEventImpl;-pub const GHOSTTY_MOUSE_ACTION_PRESS: GhosttyMouseAction = 0;-pub const GHOSTTY_MOUSE_ACTION_RELEASE: GhosttyMouseAction = 1;-pub const GHOSTTY_MOUSE_ACTION_MOTION: GhosttyMouseAction = 2;-pub const GHOSTTY_MOUSE_ACTION_MAX_VALUE: GhosttyMouseAction = 2147483647;-pub type GhosttyMouseAction = ::core::ffi::c_uint;-pub const GHOSTTY_MOUSE_BUTTON_UNKNOWN: GhosttyMouseButton = 0;-pub const GHOSTTY_MOUSE_BUTTON_LEFT: GhosttyMouseButton = 1;-pub const GHOSTTY_MOUSE_BUTTON_RIGHT: GhosttyMouseButton = 2;-pub const GHOSTTY_MOUSE_BUTTON_MIDDLE: GhosttyMouseButton = 3;-pub const GHOSTTY_MOUSE_BUTTON_FOUR: GhosttyMouseButton = 4;-pub const GHOSTTY_MOUSE_BUTTON_FIVE: GhosttyMouseButton = 5;-pub const GHOSTTY_MOUSE_BUTTON_SIX: GhosttyMouseButton = 6;-pub const GHOSTTY_MOUSE_BUTTON_SEVEN: GhosttyMouseButton = 7;-pub const GHOSTTY_MOUSE_BUTTON_EIGHT: GhosttyMouseButton = 8;-pub const GHOSTTY_MOUSE_BUTTON_NINE: GhosttyMouseButton = 9;-pub const GHOSTTY_MOUSE_BUTTON_TEN: GhosttyMouseButton = 10;-pub const GHOSTTY_MOUSE_BUTTON_ELEVEN: GhosttyMouseButton = 11;-pub const GHOSTTY_MOUSE_BUTTON_MAX_VALUE: GhosttyMouseButton = 2147483647;-pub type GhosttyMouseButton = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyMousePosition {- pub x: f32,- pub y: f32,-}-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyMouseEncoderImpl {- _unused: [u8; 0],-}-pub type GhosttyMouseEncoder = *mut GhosttyMouseEncoderImpl;-pub const GHOSTTY_MOUSE_TRACKING_NONE: GhosttyMouseTrackingMode = 0;-pub const GHOSTTY_MOUSE_TRACKING_X10: GhosttyMouseTrackingMode = 1;-pub const GHOSTTY_MOUSE_TRACKING_NORMAL: GhosttyMouseTrackingMode = 2;-pub const GHOSTTY_MOUSE_TRACKING_BUTTON: GhosttyMouseTrackingMode = 3;-pub const GHOSTTY_MOUSE_TRACKING_ANY: GhosttyMouseTrackingMode = 4;-pub const GHOSTTY_MOUSE_TRACKING_MAX_VALUE: GhosttyMouseTrackingMode = 2147483647;-pub type GhosttyMouseTrackingMode = ::core::ffi::c_uint;-pub const GHOSTTY_MOUSE_FORMAT_X10: GhosttyMouseFormat = 0;-pub const GHOSTTY_MOUSE_FORMAT_UTF8: GhosttyMouseFormat = 1;-pub const GHOSTTY_MOUSE_FORMAT_SGR: GhosttyMouseFormat = 2;-pub const GHOSTTY_MOUSE_FORMAT_URXVT: GhosttyMouseFormat = 3;-pub const GHOSTTY_MOUSE_FORMAT_SGR_PIXELS: GhosttyMouseFormat = 4;-pub const GHOSTTY_MOUSE_FORMAT_MAX_VALUE: GhosttyMouseFormat = 2147483647;-pub type GhosttyMouseFormat = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Default, Copy, Clone)]-pub struct GhosttyMouseEncoderSize {- pub size: usize,- pub screen_width: u32,- pub screen_height: u32,- pub cell_width: u32,- pub cell_height: u32,- pub padding_top: u32,- pub padding_bottom: u32,- pub padding_right: u32,- pub padding_left: u32,-}-pub const GHOSTTY_MOUSE_ENCODER_OPT_INVALID: GhosttyMouseEncoderOption = 0;-pub const GHOSTTY_MOUSE_ENCODER_OPT_EVENT: GhosttyMouseEncoderOption = 1;-pub const GHOSTTY_MOUSE_ENCODER_OPT_FORMAT: GhosttyMouseEncoderOption = 2;-pub const GHOSTTY_MOUSE_ENCODER_OPT_SIZE: GhosttyMouseEncoderOption = 3;-pub const GHOSTTY_MOUSE_ENCODER_OPT_ANY_BUTTON_PRESSED: GhosttyMouseEncoderOption = 4;-pub const GHOSTTY_MOUSE_ENCODER_OPT_TRACK_LAST_CELL: GhosttyMouseEncoderOption = 5;-pub const GHOSTTY_MOUSE_ENCODER_OPT_MAX_VALUE: GhosttyMouseEncoderOption = 2147483647;-pub type GhosttyMouseEncoderOption = ::core::ffi::c_uint;-pub const GHOSTTY_MOUSE_SHAPE_DEFAULT: GhosttyMouseShape = 0;-pub const GHOSTTY_MOUSE_SHAPE_CONTEXT_MENU: GhosttyMouseShape = 1;-pub const GHOSTTY_MOUSE_SHAPE_HELP: GhosttyMouseShape = 2;-pub const GHOSTTY_MOUSE_SHAPE_POINTER: GhosttyMouseShape = 3;-pub const GHOSTTY_MOUSE_SHAPE_PROGRESS: GhosttyMouseShape = 4;-pub const GHOSTTY_MOUSE_SHAPE_WAIT: GhosttyMouseShape = 5;-pub const GHOSTTY_MOUSE_SHAPE_CELL: GhosttyMouseShape = 6;-pub const GHOSTTY_MOUSE_SHAPE_CROSSHAIR: GhosttyMouseShape = 7;-pub const GHOSTTY_MOUSE_SHAPE_TEXT: GhosttyMouseShape = 8;-pub const GHOSTTY_MOUSE_SHAPE_VERTICAL_TEXT: GhosttyMouseShape = 9;-pub const GHOSTTY_MOUSE_SHAPE_ALIAS: GhosttyMouseShape = 10;-pub const GHOSTTY_MOUSE_SHAPE_COPY: GhosttyMouseShape = 11;-pub const GHOSTTY_MOUSE_SHAPE_MOVE: GhosttyMouseShape = 12;-pub const GHOSTTY_MOUSE_SHAPE_NO_DROP: GhosttyMouseShape = 13;-pub const GHOSTTY_MOUSE_SHAPE_NOT_ALLOWED: GhosttyMouseShape = 14;-pub const GHOSTTY_MOUSE_SHAPE_GRAB: GhosttyMouseShape = 15;-pub const GHOSTTY_MOUSE_SHAPE_GRABBING: GhosttyMouseShape = 16;-pub const GHOSTTY_MOUSE_SHAPE_ALL_SCROLL: GhosttyMouseShape = 17;-pub const GHOSTTY_MOUSE_SHAPE_COL_RESIZE: GhosttyMouseShape = 18;-pub const GHOSTTY_MOUSE_SHAPE_ROW_RESIZE: GhosttyMouseShape = 19;-pub const GHOSTTY_MOUSE_SHAPE_N_RESIZE: GhosttyMouseShape = 20;-pub const GHOSTTY_MOUSE_SHAPE_E_RESIZE: GhosttyMouseShape = 21;-pub const GHOSTTY_MOUSE_SHAPE_S_RESIZE: GhosttyMouseShape = 22;-pub const GHOSTTY_MOUSE_SHAPE_W_RESIZE: GhosttyMouseShape = 23;-pub const GHOSTTY_MOUSE_SHAPE_NE_RESIZE: GhosttyMouseShape = 24;-pub const GHOSTTY_MOUSE_SHAPE_NW_RESIZE: GhosttyMouseShape = 25;-pub const GHOSTTY_MOUSE_SHAPE_SE_RESIZE: GhosttyMouseShape = 26;-pub const GHOSTTY_MOUSE_SHAPE_SW_RESIZE: GhosttyMouseShape = 27;-pub const GHOSTTY_MOUSE_SHAPE_EW_RESIZE: GhosttyMouseShape = 28;-pub const GHOSTTY_MOUSE_SHAPE_NS_RESIZE: GhosttyMouseShape = 29;-pub const GHOSTTY_MOUSE_SHAPE_NESW_RESIZE: GhosttyMouseShape = 30;-pub const GHOSTTY_MOUSE_SHAPE_NWSE_RESIZE: GhosttyMouseShape = 31;-pub const GHOSTTY_MOUSE_SHAPE_ZOOM_IN: GhosttyMouseShape = 32;-pub const GHOSTTY_MOUSE_SHAPE_ZOOM_OUT: GhosttyMouseShape = 33;-pub const GHOSTTY_MOUSE_SHAPE_MAX_VALUE: GhosttyMouseShape = 2147483647;-pub type GhosttyMouseShape = ::core::ffi::c_uint;-pub const GHOSTTY_PASTE_SOURCE_CLIPBOARD: GhosttyPasteSource = 0;-pub const GHOSTTY_PASTE_SOURCE_TEXT: GhosttyPasteSource = 1;-pub const GHOSTTY_PASTE_SOURCE_MAX_VALUE: GhosttyPasteSource = 2147483647;-pub type GhosttyPasteSource = ::core::ffi::c_uint;-#[repr(C)]-#[derive(Debug, Copy, Clone)]-pub struct GhosttyPaste {- pub size: usize,- pub location: GhosttyClipboardLocation,- pub source: GhosttyPasteSource,- pub mimes: *const GhosttyString,- pub mimes_len: usize,- pub reader: GhosttyMimeReader,- pub allow_unsafe: bool,-}-impl Default for GhosttyPaste {- fn default() -> Self {- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();- unsafe {- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);- s.assume_init()- }- }-}-pub const GHOSTTY_SEARCH_STATUS_RUNNING: GhosttySearchStatus = 0;-pub const GHOSTTY_SEARCH_STATUS_FEED_REQUIRED: GhosttySearchStatus = 1;-pub const GHOSTTY_SEARCH_STATUS_COMPLETE: GhosttySearchStatus = 2;-pub const GHOSTTY_SEARCH_STATUS_MAX_VALUE: GhosttySearchStatus = 2147483647;-pub type GhosttySearchStatus = ::core::ffi::c_uint;-pub const GHOSTTY_SEARCH_SCROLL_IF_NEEDED: GhosttySearchScroll = 0;-pub const GHOSTTY_SEARCH_SCROLL_NONE: GhosttySearchScroll = 1;-pub const GHOSTTY_SEARCH_SCROLL_MAX_VALUE: GhosttySearchScroll = 2147483647;-pub type GhosttySearchScroll = ::core::ffi::c_uint;-pub const GHOSTTY_SEARCH_DATA_INVALID: GhosttySearchData = 0;-pub const GHOSTTY_SEARCH_DATA_STATUS: GhosttySearchData = 1;-pub const GHOSTTY_SEARCH_DATA_NEEDLE: GhosttySearchData = 2;-pub const GHOSTTY_SEARCH_DATA_TOTAL_MATCHES: GhosttySearchData = 3;-pub const GHOSTTY_SEARCH_DATA_SELECTED_INDEX: GhosttySearchData = 4;-pub const GHOSTTY_SEARCH_DATA_SELECTED_MATCH: GhosttySearchData = 5;-pub const GHOSTTY_SEARCH_DATA_MATCHES: GhosttySearchData = 6;-pub const GHOSTTY_SEARCH_DATA_VIEWPORT_MATCHES: GhosttySearchData = 7;-pub const GHOSTTY_SEARCH_DATA_SELECT_SCROLL: GhosttySearchData = 8;-pub const GHOSTTY_SEARCH_DATA_MAX_VALUE: GhosttySearchData = 2147483647;-pub type GhosttySearchData = ::core::ffi::c_uint;-pub const GHOSTTY_SEARCH_OPT_INVALID: GhosttySearchOption = 0;-pub const GHOSTTY_SEARCH_OPT_NEEDLE: GhosttySearchOption = 1;-pub const GHOSTTY_SEARCH_OPT_SELECT_SCROLL: GhosttySearchOption = 4;-pub const GHOSTTY_SEARCH_OPT_MAX_VALUE: GhosttySearchOption = 2147483647;-pub type GhosttySearchOption = ::core::ffi::c_uint;-pub const GHOSTTY_SNAPSHOT_DECODER_OPT_INVALID: GhosttySnapshotDecoderOption = 0;-pub const GHOSTTY_SNAPSHOT_DECODER_OPT_MAX_CONTINUATION_BYTES: GhosttySnapshotDecoderOption = 1;-pub const GHOSTTY_SNAPSHOT_DECODER_OPT_RETAIN_CONTINUATION: GhosttySnapshotDecoderOption = 2;-pub const GHOSTTY_SNAPSHOT_DECODER_OPT_COMPRESS_HISTORY: GhosttySnapshotDecoderOption = 3;-pub const GHOSTTY_SNAPSHOT_DECODER_OPT_KITTY_IMAGE_STORAGE_LIMIT: GhosttySnapshotDecoderOption = 4;-pub const GHOSTTY_SNAPSHOT_DECODER_OPT_MAX_VALUE: GhosttySnapshotDecoderOption = 2147483647;-pub type GhosttySnapshotDecoderOption = ::core::ffi::c_uint;-pub const GHOSTTY_SNAPSHOT_DECODER_PROGRESS_KIND_PAGE: GhosttySnapshotDecoderProgressKind = 0;-pub const GHOSTTY_SNAPSHOT_DECODER_PROGRESS_KIND_IMAGE: GhosttySnapshotDecoderProgressKind = 1;-pub const GHOSTTY_SNAPSHOT_DECODER_PROGRESS_KIND_MAX_VALUE: GhosttySnapshotDecoderProgressKind =- 2147483647;-pub type GhosttySnapshotDecoderProgressKind = ::core::ffi::c_uint;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_INVALID: GhosttySnapshotDecoderData = 0;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_MAX_CONTINUATION_BYTES: GhosttySnapshotDecoderData = 1;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_SOURCE_OFFSET: GhosttySnapshotDecoderData = 2;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_HISTORY_ROWS_PRIMARY: GhosttySnapshotDecoderData = 3;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_HISTORY_ROWS_ALTERNATE: GhosttySnapshotDecoderData = 4;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_SCREEN: GhosttySnapshotDecoderData = 5;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_ROWS: GhosttySnapshotDecoderData = 6;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_REMAINING: GhosttySnapshotDecoderData = 7;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_RETAIN_CONTINUATION: GhosttySnapshotDecoderData = 8;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_COMPRESS_HISTORY: GhosttySnapshotDecoderData = 9;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_KITTY_IMAGE_STORAGE_LIMIT: GhosttySnapshotDecoderData = 10;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_KIND: GhosttySnapshotDecoderData = 11;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_IMAGE_ID: GhosttySnapshotDecoderData = 12;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_IMAGE_FRAME: GhosttySnapshotDecoderData = 13;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_PROGRESS_IMAGE_BYTES: GhosttySnapshotDecoderData = 14;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_KITTY_IMAGES_PRIMARY: GhosttySnapshotDecoderData = 15;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_KITTY_IMAGES_ALTERNATE: GhosttySnapshotDecoderData = 16;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_KITTY_PENDING_BYTES_PRIMARY: GhosttySnapshotDecoderData =- 17;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_KITTY_PENDING_BYTES_ALTERNATE: GhosttySnapshotDecoderData =- 18;-pub const GHOSTTY_SNAPSHOT_DECODER_DATA_MAX_VALUE: GhosttySnapshotDecoderData = 2147483647;-pub type GhosttySnapshotDecoderData = ::core::ffi::c_uint;-unsafe extern "C" {- pub fn ghostty_sized_init(ptr: *mut ::core::ffi::c_void, size: usize);- pub fn ghostty_type_json() -> *const ::core::ffi::c_char;- pub fn ghostty_alloc(allocator: *const GhosttyAllocator, len: usize) -> *mut u8;- pub fn ghostty_free(allocator: *const GhosttyAllocator, ptr: *mut u8, len: usize);- pub fn ghostty_build_info(- data: GhosttyBuildInfo,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_version() -> *const ::core::ffi::c_char;- pub fn ghostty_color_rgb_get(color: *const GhosttyColorRgb, r: *mut u8, g: *mut u8, b: *mut u8);- pub fn ghostty_color_parse_x11(- name: *const ::core::ffi::c_char,- len: usize,- out: *mut GhosttyColorRgb,- ) -> GhosttyResult;- pub fn ghostty_color_parse(- value: *const ::core::ffi::c_char,- len: usize,- out: *mut GhosttyColorRgb,- ) -> GhosttyResult;- pub fn ghostty_color_parse_palette_entry(- value: *const ::core::ffi::c_char,- len: usize,- out_index: *mut u8,- out_rgb: *mut GhosttyColorRgb,- ) -> GhosttyResult;- pub fn ghostty_color_palette_default(out: *mut GhosttyColorRgb);- pub fn ghostty_color_palette_generate(- base: *const GhosttyColorRgb,- skip: *const GhosttyColorPaletteMask,- bg: *const GhosttyColorRgb,- fg: *const GhosttyColorRgb,- harmonious: bool,- out: *mut GhosttyColorRgb,- );- pub fn ghostty_color_luminance(color: *const GhosttyColorRgb) -> f64;- pub fn ghostty_color_perceived_luminance(color: *const GhosttyColorRgb) -> f64;- pub fn ghostty_color_contrast(a: *const GhosttyColorRgb, b: *const GhosttyColorRgb) -> f64;- pub fn ghostty_color_x11_names() -> *const GhosttyColorX11Entry;- pub fn ghostty_color_x11_name_count() -> usize;- pub fn ghostty_color_scheme_report_encode(- scheme: GhosttyColorScheme,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_focus_encode(- event: GhosttyFocusEvent,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_cell_get(- cell: GhosttyCell,- data: GhosttyCellData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_cell_get_multi(- cell: GhosttyCell,- count: usize,- keys: *const GhosttyCellData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_row_get(- row: GhosttyRow,- data: GhosttyRowData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_row_get_multi(- row: GhosttyRow,- count: usize,- keys: *const GhosttyRowData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_style_default(style: *mut GhosttyStyle);- pub fn ghostty_style_is_default(style: *const GhosttyStyle) -> bool;- pub fn ghostty_grid_ref_cell(- ref_: *const GhosttyGridRef,- out_cell: *mut GhosttyCell,- ) -> GhosttyResult;- pub fn ghostty_grid_ref_row(- ref_: *const GhosttyGridRef,- out_row: *mut GhosttyRow,- ) -> GhosttyResult;- pub fn ghostty_grid_ref_graphemes(- ref_: *const GhosttyGridRef,- buf: *mut u32,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_grid_ref_hyperlink_uri(- ref_: *const GhosttyGridRef,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_grid_ref_style(- ref_: *const GhosttyGridRef,- out_style: *mut GhosttyStyle,- ) -> GhosttyResult;- pub fn ghostty_selection_gesture_event_new(- allocator: *const GhosttyAllocator,- out_event: *mut GhosttySelectionGestureEvent,- type_: GhosttySelectionGestureEventType,- ) -> GhosttyResult;- pub fn ghostty_selection_gesture_event_free(event: GhosttySelectionGestureEvent);- pub fn ghostty_selection_gesture_event_set(- event: GhosttySelectionGestureEvent,- option: GhosttySelectionGestureEventOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_selection_gesture_event(- gesture: GhosttySelectionGesture,- terminal: GhosttyTerminal,- event: GhosttySelectionGestureEvent,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_selection_gesture_new(- allocator: *const GhosttyAllocator,- out_gesture: *mut GhosttySelectionGesture,- ) -> GhosttyResult;- pub fn ghostty_selection_gesture_free(- gesture: GhosttySelectionGesture,- terminal: GhosttyTerminal,- );- pub fn ghostty_selection_gesture_reset(- gesture: GhosttySelectionGesture,- terminal: GhosttyTerminal,- );- pub fn ghostty_selection_gesture_get(- gesture: GhosttySelectionGesture,- terminal: GhosttyTerminal,- data: GhosttySelectionGestureData,- value: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_selection_gesture_get_multi(- gesture: GhosttySelectionGesture,- terminal: GhosttyTerminal,- count: usize,- keys: *const GhosttySelectionGestureData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_terminal_select_word(- terminal: GhosttyTerminal,- options: *const GhosttyTerminalSelectWordOptions,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_terminal_select_word_between(- terminal: GhosttyTerminal,- options: *const GhosttyTerminalSelectWordBetweenOptions,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_terminal_select_line(- terminal: GhosttyTerminal,- options: *const GhosttyTerminalSelectLineOptions,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_terminal_select_all(- terminal: GhosttyTerminal,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_terminal_select_output(- terminal: GhosttyTerminal,- ref_: *const GhosttyGridRef,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_terminal_selection_adjust(- terminal: GhosttyTerminal,- selection: *mut GhosttySelection,- adjustment: GhosttySelectionAdjust,- ) -> GhosttyResult;- pub fn ghostty_terminal_selection_order(- terminal: GhosttyTerminal,- selection: *const GhosttySelection,- out_order: *mut GhosttySelectionOrder,- ) -> GhosttyResult;- pub fn ghostty_terminal_selection_ordered(- terminal: GhosttyTerminal,- selection: *const GhosttySelection,- desired: GhosttySelectionOrder,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_terminal_selection_contains(- terminal: GhosttyTerminal,- selection: *const GhosttySelection,- point: GhosttyPoint,- out_contains: *mut bool,- ) -> GhosttyResult;- pub fn ghostty_terminal_selection_equal(- terminal: GhosttyTerminal,- a: *const GhosttySelection,- b: *const GhosttySelection,- out_equal: *mut bool,- ) -> GhosttyResult;- pub fn ghostty_mode_report_encode(- mode: GhosttyMode,- state: GhosttyModeReportState,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_osc_new(- allocator: *const GhosttyAllocator,- parser: *mut GhosttyOscParser,- ) -> GhosttyResult;- pub fn ghostty_osc_free(parser: GhosttyOscParser);- pub fn ghostty_osc_reset(parser: GhosttyOscParser);- pub fn ghostty_osc_set(- parser: GhosttyOscParser,- option: GhosttyOscOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_osc_next(parser: GhosttyOscParser, byte: u8);- pub fn ghostty_osc_end(parser: GhosttyOscParser, terminator: u8) -> GhosttyOscCommand;- pub fn ghostty_osc_command_type(command: GhosttyOscCommand) -> GhosttyOscCommandType;- pub fn ghostty_osc_command_data(- command: GhosttyOscCommand,- data: GhosttyOscCommandData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_size_report_encode(- style: GhosttySizeReportStyle,- size: *const GhosttySizeReportSize,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_get(- graphics: GhosttyKittyGraphics,- data: GhosttyKittyGraphicsData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_animation_tick(- graphics: GhosttyKittyGraphics,- now_ms: u64,- next_ms: *mut u64,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_image(- graphics: GhosttyKittyGraphics,- image_id: u32,- ) -> GhosttyKittyGraphicsImage;- pub fn ghostty_kitty_graphics_image_get(- image: GhosttyKittyGraphicsImage,- data: GhosttyKittyGraphicsImageData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_image_get_multi(- image: GhosttyKittyGraphicsImage,- count: usize,- keys: *const GhosttyKittyGraphicsImageData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_iterator_new(- allocator: *const GhosttyAllocator,- out_iterator: *mut GhosttyKittyGraphicsPlacementIterator,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_iterator_free(- iterator: GhosttyKittyGraphicsPlacementIterator,- );- pub fn ghostty_kitty_graphics_placement_iterator_set(- iterator: GhosttyKittyGraphicsPlacementIterator,- option: GhosttyKittyGraphicsPlacementIteratorOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_next(- iterator: GhosttyKittyGraphicsPlacementIterator,- ) -> bool;- pub fn ghostty_kitty_graphics_placement_get(- iterator: GhosttyKittyGraphicsPlacementIterator,- data: GhosttyKittyGraphicsPlacementData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_get_multi(- iterator: GhosttyKittyGraphicsPlacementIterator,- count: usize,- keys: *const GhosttyKittyGraphicsPlacementData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_rect(- iterator: GhosttyKittyGraphicsPlacementIterator,- image: GhosttyKittyGraphicsImage,- terminal: GhosttyTerminal,- out_selection: *mut GhosttySelection,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_pixel_size(- iterator: GhosttyKittyGraphicsPlacementIterator,- image: GhosttyKittyGraphicsImage,- terminal: GhosttyTerminal,- out_width: *mut u32,- out_height: *mut u32,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_grid_size(- iterator: GhosttyKittyGraphicsPlacementIterator,- image: GhosttyKittyGraphicsImage,- terminal: GhosttyTerminal,- out_cols: *mut u32,- out_rows: *mut u32,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_viewport_pos(- iterator: GhosttyKittyGraphicsPlacementIterator,- image: GhosttyKittyGraphicsImage,- terminal: GhosttyTerminal,- out_col: *mut i32,- out_row: *mut i32,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_source_rect(- iterator: GhosttyKittyGraphicsPlacementIterator,- image: GhosttyKittyGraphicsImage,- out_x: *mut u32,- out_y: *mut u32,- out_width: *mut u32,- out_height: *mut u32,- ) -> GhosttyResult;- pub fn ghostty_kitty_graphics_placement_render_info(- iterator: GhosttyKittyGraphicsPlacementIterator,- image: GhosttyKittyGraphicsImage,- terminal: GhosttyTerminal,- out_info: *mut GhosttyKittyGraphicsPlacementRenderInfo,- ) -> GhosttyResult;- pub fn ghostty_terminal_new(- allocator: *const GhosttyAllocator,- terminal: *mut GhosttyTerminal,- cols: u16,- rows: u16,- ) -> GhosttyResult;- pub fn ghostty_terminal_free(terminal: GhosttyTerminal);- pub fn ghostty_terminal_reset(terminal: GhosttyTerminal);- pub fn ghostty_terminal_resize(- terminal: GhosttyTerminal,- cols: u16,- rows: u16,- cell_width_px: u32,- cell_height_px: u32,- ) -> GhosttyResult;- pub fn ghostty_terminal_set(- terminal: GhosttyTerminal,- option: GhosttyTerminalOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_terminal_vt_write(terminal: GhosttyTerminal, data: *const u8, len: usize);- pub fn ghostty_terminal_vt_write_until(- terminal: GhosttyTerminal,- data: *const u8,- len: usize,- boundaries: u32,- out: *mut GhosttyTerminalWriteStop,- ) -> GhosttyResult;- pub fn ghostty_terminal_continuation_write(- terminal: GhosttyTerminal,- writer: GhosttyWriter,- ) -> GhosttyResult;- pub fn ghostty_terminal_continuation_buf(- terminal: GhosttyTerminal,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_terminal_continuation_alloc(- terminal: GhosttyTerminal,- allocator: *const GhosttyAllocator,- out_ptr: *mut *mut u8,- out_len: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_terminal_scroll_viewport(- terminal: GhosttyTerminal,- behavior: GhosttyTerminalScrollViewport,- ) -> GhosttyResult;- pub fn ghostty_terminal_compression_activity(- terminal: GhosttyTerminal,- out_activity: *mut u64,- ) -> GhosttyResult;- pub fn ghostty_terminal_compress(- terminal: GhosttyTerminal,- mode: GhosttyTerminalCompressionMode,- out_result: *mut GhosttyTerminalCompressionResult,- ) -> GhosttyResult;- pub fn ghostty_terminal_get(- terminal: GhosttyTerminal,- data: GhosttyTerminalData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_terminal_get_multi(- terminal: GhosttyTerminal,- count: usize,- keys: *const GhosttyTerminalData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_terminal_grid_ref(- terminal: GhosttyTerminal,- point: GhosttyPoint,- out_ref: *mut GhosttyGridRef,- ) -> GhosttyResult;- pub fn ghostty_terminal_grid_ref_track(- terminal: GhosttyTerminal,- point: GhosttyPoint,- out_ref: *mut GhosttyTrackedGridRef,- ) -> GhosttyResult;- pub fn ghostty_terminal_point_from_grid_ref(- terminal: GhosttyTerminal,- ref_: *const GhosttyGridRef,- tag: GhosttyPointTag,- out: *mut GhosttyPointCoordinate,- ) -> GhosttyResult;- pub fn ghostty_formatter_terminal_new(- allocator: *const GhosttyAllocator,- formatter: *mut GhosttyFormatter,- terminal: GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_formatter_set(- formatter: GhosttyFormatter,- option: GhosttyFormatterOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_formatter_get(- formatter: GhosttyFormatter,- option: GhosttyFormatterOption,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_formatter_format(- formatter: GhosttyFormatter,- writer: GhosttyWriter,- ) -> GhosttyResult;- pub fn ghostty_formatter_format_buf(- formatter: GhosttyFormatter,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_formatter_format_alloc(- formatter: GhosttyFormatter,- allocator: *const GhosttyAllocator,- out_ptr: *mut *mut u8,- out_len: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_formatter_free(formatter: GhosttyFormatter);- pub fn ghostty_render_state_new(- allocator: *const GhosttyAllocator,- state: *mut GhosttyRenderState,- ) -> GhosttyResult;- pub fn ghostty_render_state_free(state: GhosttyRenderState);- pub fn ghostty_render_state_update(- state: GhosttyRenderState,- terminal: GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_render_state_begin_update(- state: GhosttyRenderState,- terminal: GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_render_state_end_update(state: GhosttyRenderState) -> GhosttyResult;- pub fn ghostty_render_state_clean(state: GhosttyRenderState) -> GhosttyResult;- pub fn ghostty_render_state_get(- state: GhosttyRenderState,- data: GhosttyRenderStateData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_render_state_get_multi(- state: GhosttyRenderState,- count: usize,- keys: *const GhosttyRenderStateData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_render_state_set(- state: GhosttyRenderState,- option: GhosttyRenderStateOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_iterator_new(- allocator: *const GhosttyAllocator,- out_iterator: *mut GhosttyRenderStateRowIterator,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_iterator_free(iterator: GhosttyRenderStateRowIterator);- pub fn ghostty_render_state_row_iterator_next(iterator: GhosttyRenderStateRowIterator) -> bool;- pub fn ghostty_render_state_row_iterator_next_dirty(- iterator: GhosttyRenderStateRowIterator,- out_y: *mut u16,- ) -> bool;- pub fn ghostty_render_state_row_get(- iterator: GhosttyRenderStateRowIterator,- data: GhosttyRenderStateRowData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_get_multi(- iterator: GhosttyRenderStateRowIterator,- count: usize,- keys: *const GhosttyRenderStateRowData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_set(- iterator: GhosttyRenderStateRowIterator,- option: GhosttyRenderStateRowOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_cells_new(- allocator: *const GhosttyAllocator,- out_cells: *mut GhosttyRenderStateRowCells,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_cells_next(cells: GhosttyRenderStateRowCells) -> bool;- pub fn ghostty_render_state_row_cells_select(- cells: GhosttyRenderStateRowCells,- x: u16,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_cells_get(- cells: GhosttyRenderStateRowCells,- data: GhosttyRenderStateRowCellsData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_cells_get_multi(- cells: GhosttyRenderStateRowCells,- count: usize,- keys: *const GhosttyRenderStateRowCellsData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_render_state_row_cells_free(cells: GhosttyRenderStateRowCells);- pub fn ghostty_render_state_image_iterator_new(- allocator: *const GhosttyAllocator,- out_iterator: *mut GhosttyRenderStateImageIterator,- ) -> GhosttyResult;- pub fn ghostty_render_state_image_iterator_free(iterator: GhosttyRenderStateImageIterator);- pub fn ghostty_render_state_image_iterator_next(- iterator: GhosttyRenderStateImageIterator,- ) -> bool;- pub fn ghostty_render_state_image_get(- iterator: GhosttyRenderStateImageIterator,- data: GhosttyRenderStateImageData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_render_state_image_get_multi(- iterator: GhosttyRenderStateImageIterator,- count: usize,- keys: *const GhosttyRenderStateImageData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_tracked_grid_ref_free(ref_: GhosttyTrackedGridRef);- pub fn ghostty_tracked_grid_ref_has_value(ref_: GhosttyTrackedGridRef) -> bool;- pub fn ghostty_tracked_grid_ref_point(- ref_: GhosttyTrackedGridRef,- tag: GhosttyPointTag,- out_point: *mut GhosttyPointCoordinate,- ) -> GhosttyResult;- pub fn ghostty_tracked_grid_ref_set(- ref_: GhosttyTrackedGridRef,- terminal: GhosttyTerminal,- point: GhosttyPoint,- ) -> GhosttyResult;- pub fn ghostty_tracked_grid_ref_snapshot(- ref_: GhosttyTrackedGridRef,- out_ref: *mut GhosttyGridRef,- ) -> GhosttyResult;- pub fn ghostty_sgr_new(- allocator: *const GhosttyAllocator,- parser: *mut GhosttySgrParser,- ) -> GhosttyResult;- pub fn ghostty_sgr_free(parser: GhosttySgrParser);- pub fn ghostty_sgr_reset(parser: GhosttySgrParser);- pub fn ghostty_sgr_set_params(- parser: GhosttySgrParser,- params: *const u16,- separators: *const ::core::ffi::c_char,- len: usize,- ) -> GhosttyResult;- pub fn ghostty_sgr_next(parser: GhosttySgrParser, attr: *mut GhosttySgrAttribute) -> bool;- pub fn ghostty_sgr_unknown_full(unknown: GhosttySgrUnknown, ptr: *mut *const u16) -> usize;- pub fn ghostty_sgr_unknown_partial(unknown: GhosttySgrUnknown, ptr: *mut *const u16) -> usize;- pub fn ghostty_sgr_attribute_tag(attr: *const GhosttySgrAttribute) -> GhosttySgrAttributeTag;- pub fn ghostty_sgr_attribute_value(- attr: *mut GhosttySgrAttribute,- ) -> *mut GhosttySgrAttributeValue;- pub fn ghostty_sys_set(- option: GhosttySysOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_sys_log_stderr(- userdata: *mut ::core::ffi::c_void,- level: GhosttySysLogLevel,- scope: *const u8,- scope_len: usize,- message: *const u8,- message_len: usize,- );- pub fn ghostty_key_event_new(- allocator: *const GhosttyAllocator,- event: *mut GhosttyKeyEvent,- ) -> GhosttyResult;- pub fn ghostty_key_event_free(event: GhosttyKeyEvent);- pub fn ghostty_key_event_set_action(- event: GhosttyKeyEvent,- action: GhosttyKeyAction,- ) -> GhosttyResult;- pub fn ghostty_key_event_get_action(event: GhosttyKeyEvent) -> GhosttyKeyAction;- pub fn ghostty_key_event_set_key(event: GhosttyKeyEvent, key: GhosttyKey) -> GhosttyResult;- pub fn ghostty_key_event_get_key(event: GhosttyKeyEvent) -> GhosttyKey;- pub fn ghostty_key_event_set_mods(event: GhosttyKeyEvent, mods: GhosttyMods) -> GhosttyResult;- pub fn ghostty_key_event_get_mods(event: GhosttyKeyEvent) -> GhosttyMods;- pub fn ghostty_key_event_set_consumed_mods(- event: GhosttyKeyEvent,- consumed_mods: GhosttyMods,- ) -> GhosttyResult;- pub fn ghostty_key_event_get_consumed_mods(event: GhosttyKeyEvent) -> GhosttyMods;- pub fn ghostty_key_event_set_composing(- event: GhosttyKeyEvent,- composing: bool,- ) -> GhosttyResult;- pub fn ghostty_key_event_get_composing(event: GhosttyKeyEvent) -> bool;- pub fn ghostty_key_event_set_utf8(event: GhosttyKeyEvent, utf8: GhosttyString)- -> GhosttyResult;- pub fn ghostty_key_event_get_utf8(event: GhosttyKeyEvent) -> GhosttyString;- pub fn ghostty_key_event_set_unshifted_codepoint(- event: GhosttyKeyEvent,- codepoint: u32,- ) -> GhosttyResult;- pub fn ghostty_key_event_get_unshifted_codepoint(event: GhosttyKeyEvent) -> u32;- pub fn ghostty_key_encoder_new(- allocator: *const GhosttyAllocator,- encoder: *mut GhosttyKeyEncoder,- ) -> GhosttyResult;- pub fn ghostty_key_encoder_free(encoder: GhosttyKeyEncoder);- pub fn ghostty_key_encoder_set(- encoder: GhosttyKeyEncoder,- option: GhosttyKeyEncoderOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_key_encoder_set_from_terminal(- encoder: GhosttyKeyEncoder,- terminal: GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_key_encoder_encode(- encoder: GhosttyKeyEncoder,- event: GhosttyKeyEvent,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_new(- allocator: *const GhosttyAllocator,- event: *mut GhosttyMouseEvent,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_free(event: GhosttyMouseEvent);- pub fn ghostty_mouse_event_set_action(- event: GhosttyMouseEvent,- action: GhosttyMouseAction,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_get_action(event: GhosttyMouseEvent) -> GhosttyMouseAction;- pub fn ghostty_mouse_event_set_button(- event: GhosttyMouseEvent,- button: GhosttyMouseButton,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_clear_button(event: GhosttyMouseEvent) -> GhosttyResult;- pub fn ghostty_mouse_event_get_button(- event: GhosttyMouseEvent,- out_button: *mut GhosttyMouseButton,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_set_mods(- event: GhosttyMouseEvent,- mods: GhosttyMods,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_get_mods(event: GhosttyMouseEvent) -> GhosttyMods;- pub fn ghostty_mouse_event_set_position(- event: GhosttyMouseEvent,- position: GhosttyMousePosition,- ) -> GhosttyResult;- pub fn ghostty_mouse_event_get_position(event: GhosttyMouseEvent) -> GhosttyMousePosition;- pub fn ghostty_mouse_encoder_new(- allocator: *const GhosttyAllocator,- encoder: *mut GhosttyMouseEncoder,- ) -> GhosttyResult;- pub fn ghostty_mouse_encoder_free(encoder: GhosttyMouseEncoder);- pub fn ghostty_mouse_encoder_set(- encoder: GhosttyMouseEncoder,- option: GhosttyMouseEncoderOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_mouse_encoder_set_from_terminal(- encoder: GhosttyMouseEncoder,- terminal: GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_mouse_encoder_reset(encoder: GhosttyMouseEncoder) -> GhosttyResult;- pub fn ghostty_mouse_encoder_encode(- encoder: GhosttyMouseEncoder,- event: GhosttyMouseEvent,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_terminal_paste(- terminal: GhosttyTerminal,- paste: *const GhosttyPaste,- out_pasted: *mut bool,- ) -> GhosttyResult;- pub fn ghostty_paste_is_safe(data: *const ::core::ffi::c_char, len: usize) -> bool;- pub fn ghostty_paste_encode(- data: *mut ::core::ffi::c_char,- data_len: usize,- bracketed: bool,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_search_new(- allocator: *const GhosttyAllocator,- out_search: *mut GhosttySearch,- terminal: GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_search_free(search: GhosttySearch);- pub fn ghostty_search_tick(- search: GhosttySearch,- out_status: *mut GhosttySearchStatus,- ) -> GhosttyResult;- pub fn ghostty_search_feed(search: GhosttySearch) -> GhosttyResult;- pub fn ghostty_search_run(search: GhosttySearch) -> GhosttyResult;- pub fn ghostty_search_select_next(search: GhosttySearch) -> GhosttyResult;- pub fn ghostty_search_select_prev(search: GhosttySearch) -> GhosttyResult;- pub fn ghostty_search_set(- search: GhosttySearch,- option: GhosttySearchOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_search_get(- search: GhosttySearch,- data: GhosttySearchData,- value: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_search_get_multi(- search: GhosttySearch,- count: usize,- keys: *const GhosttySearchData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_snapshot_encode(- terminal: GhosttyTerminal,- writer: GhosttyWriter,- ) -> GhosttyResult;- pub fn ghostty_snapshot_encode_buf(- terminal: GhosttyTerminal,- buf: *mut u8,- buf_len: usize,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_snapshot_encode_alloc(- terminal: GhosttyTerminal,- allocator: *const GhosttyAllocator,- out_ptr: *mut *mut u8,- out_len: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_new(- allocator: *const GhosttyAllocator,- decoder: *mut GhosttySnapshotDecoder,- reader: GhosttyReader,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_new_buf(- allocator: *const GhosttyAllocator,- decoder: *mut GhosttySnapshotDecoder,- ptr: *const u8,- len: usize,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_free(decoder: GhosttySnapshotDecoder);- pub fn ghostty_snapshot_decoder_set(- decoder: GhosttySnapshotDecoder,- option: GhosttySnapshotDecoderOption,- value: *const ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_ready(- decoder: GhosttySnapshotDecoder,- terminal: *mut GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_next(decoder: GhosttySnapshotDecoder) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_decode(- decoder: GhosttySnapshotDecoder,- terminal: *mut GhosttyTerminal,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_get(- decoder: GhosttySnapshotDecoder,- data: GhosttySnapshotDecoderData,- out: *mut ::core::ffi::c_void,- ) -> GhosttyResult;- pub fn ghostty_snapshot_decoder_get_multi(- decoder: GhosttySnapshotDecoder,- count: usize,- keys: *const GhosttySnapshotDecoderData,- values: *mut *mut ::core::ffi::c_void,- out_written: *mut usize,- ) -> GhosttyResult;- pub fn ghostty_unicode_codepoint_width(cp: u32) -> u8;- pub fn ghostty_unicode_grapheme_width(cps: *const u32, len: usize, width: *mut u8) -> usize;-}diff --git a/native/crates/ghostty_vt/src/tests.rs b/native/crates/ghostty_vt/src/tests.rsindex e58f2841e5e..1bcbf6663e3 100644--- a/native/crates/ghostty_vt/src/tests.rs+++ b/native/crates/ghostty_vt/src/tests.rs@@ -33,6 +33,19 @@ fn wide_characters_and_combining_marks_keep_their_cells() {assert_eq!((row[Column(2)].c, row[Column(2)].zerowidth.as_slice()), ('e', &['\u{301}'][..]));}+#[test]+fn the_viewport_rows_match_the_rows_read_one_cell_at_a_time() {+ let mut term = term(10, 4);+ for _ in 0..6 {+ term.advance(b"\x1b[4:3;58;5;9mscroll\x1b[0m\r\n");+ }+ term.advance("\x1b[1;31ma\x1b[32mb\x1b[1;31mc\x1b[0m 界e\u{301}\r\n\x1b[44m\x1b[K\x1b[48;2;1;2;3mx\x1b[K\x1b[0m\r\n0123456789wrap\r\n".as_bytes());+ term.scroll_display(Scroll::Delta(2));+ let rows: Vec<Row> = (0..4).map(|line| term.row(Line(line - 2))).collect();+ assert!(rows[3][Column(9)].flags.contains(Flags::WRAPLINE));+ assert_eq!(term.viewport_rows(), rows);+}+#[test]fn a_variation_selector_stays_with_its_emoji() {let mut term = term(10, 2);diff --git a/port/notes.md b/port/notes.mdindex f1d9aed757c..1b4e8a4189e 100644--- a/port/notes.md+++ b/port/notes.md@@ -629,11 +629,10 @@ Scope (milestone 13): diagnostics, hover, completion, go to definition and peek,## Milestone 15: integrated terminal-- Backend: libghostty-vt 1.0.2 (MIT, tag `vt-1.0.2`, Ghostty's C API VT library) is the VT parser and screen model in place of xterm.js, behind `native/crates/ghostty_vt` (the only `unsafe` code of the terminal: bindgen bindings of `vt.h` in `sys.rs`, a safe `Term` in `lib.rs`); the PTY is the port's own node-pty (`terminal/pty.rs`: openpty, setsid, TIOCSCTTY, PWD set to the cwd as `unixTerminal.ts` does; ConPTY on Windows). Wu's `terminal` crate is GPL-3.0 and is not used. It replaced `alacritty_terminal` 0.25 for the parser's throughput and for a maintained VT core with a stable C ABI; `Term` keeps alacritty's shapes (`Line` relative to the active area's top, negative into the scrollback, `Point`, `Cell`, `Flags`, `TermMode`) so the call sites read the same.-- libghostty-vt build (`ghostty_vt/build.rs`): the release source and dependency tarballs from release.files.ghostty.org, checked against pinned SHA-256s, built with Zig 0.17 (`-Doptimize=ReleaseFast -Dcpu=baseline`, macOS deployment target 12.0 as `package-app`'s `LSMinimumSystemVersion`); `GHOSTTY_VT_LIB_DIR` links a prebuilt one instead. macOS arm64 and Linux arm64/x64 build their own target; Windows builds `*-windows-msvc` from source on Windows (windows.yml), while a cross build from macOS (`port/tools/windows-build`) links the `*-windows-gnu` archive with lld-link, as Zig 0.17 cannot compile the bundled simdutf and highway against cargo-xwin's MSVC SDK (Microsoft's link.exe rejects that archive's COMDATs, LNK1143, lld-link takes it). Zig is in the Linux image, linux.yml and windows.yml.-- libghostty-vt 1.0.2 drops U+FE0F after an emoji modifier base (U+270C, U+1F44D) outside grapheme cluster mode 2027, as its Unicode tables give those `emoji_modifier_base` and not `extended_pictographic`; xterm.js keeps it, so `build.rs` patches the one check in `Terminal.zig` (`a_variation_selector_stays_with_its_emoji`, prompt_input's `emoji_input`).-- What the port takes from libghostty-vt and what it keeps: the grid, scrollback, modes, cursor style, OSC 4/10/11/12 colors, title, bell, DA1/DA2/XTVERSION replies (set to xterm.js 6.1.0-beta.337's: `?1;2c`, `>0;276;0c`) come from libghostty-vt's callbacks; OSC 52, OSC 633/133/1337/7 stay with `terminal/shell_integration.rs` (it splits the stream before the parser), OSC 99 with `terminal/osc99.rs`, keys and mouse reports with `terminal/keys.rs` and `terminal/mouse.rs` (xterm.js's encodings, not libghostty-vt's key encoder). Selection follows alacritty 0.25's rules (`ghostty_vt/src/selection.rs`: simple, semantic, lines, block) with its anchors as libghostty-vt tracked references, so a selection moves with scrolled output as xterm.js's does.-- Terminal throughput and typing (Mac Studio, release): `cat` of 32 MB of colored `ls -l` lines into a 120x40 terminal with 10000 lines of scrollback, 143 MB/s with alacritty_terminal, 700 MB/s with libghostty-vt; reading the 4800 visible cells after one echoed key, p95 8 us with alacritty, 120 us with libghostty-vt (each cell is a grid reference call); a key echoed and the workbench drawn (`terminal_typing_frame_time`), p95 4.0 to 4.4 ms before and 4.0 to 5.1 ms after, against the 16 ms gate.+- Backend: libghostty-vt 1.0.2 (MIT, tag `vt-1.0.2`, Ghostty's C API VT library) is the VT parser and screen model in place of xterm.js, behind `native/crates/ghostty_vt`, a safe `Term` with no `unsafe` of its own on the libghostty-rs bindings (`libghostty-vt` and `libghostty-vt-sys`, MIT OR Apache-2.0, https://github.com/uzaaft/libghostty-rs); the PTY is the port's own node-pty (`terminal/pty.rs`: openpty, setsid, TIOCSCTTY, PWD set to the cwd as `unixTerminal.ts` does; ConPTY on Windows). Wu's `terminal` crate is GPL-3.0 and is not used. It replaced `alacritty_terminal` 0.25 for the parser's throughput and for a maintained VT core with a stable C ABI; `Term` keeps alacritty's shapes (`Line` relative to the active area's top, negative into the scrollback, `Point`, `Cell`, `Flags`, `TermMode`) so the call sites read the same.+- libghostty-rs is a git dependency on the port's fork, https://github.com/rokartur/libghostty-rs branch `vsrustium` (rev 10df3e18), one commit over uzaaft's d3a306c, not crates.io 0.2.2: 0.2.2's `libghostty-vt-sys` builds Ghostty a887df42, 2333 commits before `vt-1.0.2`, and d3a306c builds `vt-1.0.2` (573c4a21). The fork's commit touches only `libghostty-vt-sys/build.rs`: (1) VS16 patch: Ghostty 1.0.2 drops U+FE0F after an emoji modifier base (U+270C, U+1F44D) outside mode 2027, as uucode gives those `emoji_modifier_base` rather than `extended_pictographic`, while xterm.js keeps it, so copied text keeps it (`ghostty_vt` `a_variation_selector_stays_with_its_emoji`, `prompt_input` `emoji_input`); the build stops when the patched line in `Terminal.zig` is not there exactly once, and Ghostty main still has the bug; (2) an MSVC cross build from a non-Windows host (`port/tools/windows-build`) builds the `*-windows-gnu` archive, as Zig 0.17 cannot compile the bundled simdutf and highway against cargo-xwin's MSVC SDK (Microsoft's link.exe rejects that archive's COMDATs, LNK1143, lld-link takes it); (3) the static Windows archive links ntdll. Drop the fork when upstream takes these: (2) and (3) fit an upstream PR, (1) belongs in Ghostty. The pin is the rev in Cargo.lock plus the Ghostty commit in the sys crate's `build.rs`, which clones Ghostty by commit (SHA-1, where the old build checked the release tarballs' SHA-256) and builds it with Zig 0.17 (`-Dcpu=baseline`); `zig build` checks the dependencies against `build.zig.zon`'s hashes. `native/.cargo/config.toml` sets `LIBGHOSTTY_VT_SYS_OPTIMIZE=ReleaseFast`: the sys build picks Zig Debug whenever cargo's `DEBUG` is true, which the release profile's `debug = "limited"` makes it, and Debug's page integrity checks made a 32 MB `cat` take minutes. On a macOS host Ghostty's `Config.zig` replaces any `-Dtarget` with its generic macOS 13.0 target, so the library's objects say `minos 13.0` (with the old build too) while `package-app` writes `LSMinimumSystemVersion` 12.0. The paint path reads the viewport through the render state (`Term::viewport_rows`): libghostty-rs's examples (`example/ghostling_rs`, `example/rust-vt-render`) read each cell's style through `CellIteration::style`, while `viewport_rows` reads a row's raw cells in one call and looks a style up once per style id in the row. macOS arm64 and Linux arm64/x64 build their own target; Windows builds `*-windows-msvc` from source on Windows (windows.yml). Zig is in the Linux image, linux.yml and windows.yml.+- What the port takes from libghostty-vt and what it keeps: the grid, scrollback, modes, cursor style, OSC 4/10/11/12 colors, title, bell, DA1/DA2/XTVERSION replies (set to xterm.js 6.1.0-beta.337's: `?1;2c`, `>0;276;0c`) come from libghostty-vt's callbacks; OSC 52, OSC 633/133/1337/7 stay with `terminal/shell_integration.rs` (it splits the stream before the parser), OSC 99 with `terminal/osc99.rs`, keys and mouse reports with `terminal/keys.rs` and `terminal/mouse.rs` (xterm.js's encodings, not libghostty-vt's key encoder). Selection follows alacritty 0.25's rules (`ghostty_vt/src/selection.rs`: simple, semantic, lines, block) with its anchors as libghostty-vt tracked references, so a selection moves with scrolled output as xterm.js's does. libghostty-rs's `selection::Gesture` is not used: it is Ghostty's click and drag model (its click counts, word boundaries and text formatting), while the port's selection tests pin xterm.js-shaped results.+- Terminal throughput and typing (Mac Studio, release): `cat` of 32 MB of colored `ls -l` lines into a 120x40 terminal with 10000 lines of scrollback, 143 MB/s with alacritty_terminal, 700 MB/s with libghostty-vt; reading the 4800 visible cells after one echoed key, p95 8 us with alacritty, 120 us with libghostty-vt (each cell is a grid reference call); a key echoed and the workbench drawn (`terminal_typing_frame_time`), p95 4.0 to 4.4 ms before and 4.0 to 5.1 ms after, against the 16 ms gate. Moving to libghostty-rs, same Studio under load, one run each after a warm build: the in-process `Term::advance` of the same 32 MB, 484 MB/s on the port's own bindings and 487 MB/s on libghostty-rs; the 4800 visible cells, median 119 us (p95 128) cell by cell on the port's bindings, 291 us (p95 294) cell by cell on libghostty-rs, which `viewport_rows` brings to 122 us (p95 125); `terminal_typing_frame_time` p95 5.16 ms before and 4.40 ms after.- Keys follow xterm.js `Keyboard.ts` (`terminal/keys.rs`), mouse reports `CoreMouseService` DEFAULT and SGR (`terminal/mouse.rs`). `terminal/skip_shell.rs` is `DEFAULT_COMMANDS_TO_SKIP_SHELL` plus the terminalContrib lists of 1.147.0: a keybinding to one of them runs instead of reaching the shell.- The Terminal view is a panel view (milestone 11, `register_terminal_panel_view`); its title actions (the active terminal, New with the profiles dropdown, Split, Kill, per `tabs.showActiveTerminal` and `tabs.showActions`) are in the panel's title bar. The tabs list, splits and groups are drawn inside the view.- shortcut: the view title's "..." menu (a panel view's menu) is not ported. Contributed profiles came with 3108345ce25 (`a_contributed_profile_is_picked_and_created_by_its_provider`); the Ctrl+D exit exception keeps xtermTerminal.ts `lastInputEvent` (`a_ctrl_d_exit_shows_no_exit_alert`).