Files
ghostty/example/c-vt-render
Mitchell Hashimoto b4079f00c8 libghostty: add render state structured cursor read
A normal renderer would have to call `ghostty_render_state_get`
_eight times_ to reconstruct the cursor. In languages where FFI is
expensive (Go, wasm, etc.), this showed up in profiles of every frame.

Add a sized cursor snapshot and expose it. Also expose the existing color
snapshot through ghostty_render_state_get and remove the older
dedicated color getter.
2026-08-15 20:54:40 -07:00
..

Example: ghostty-vt Render State

This contains an example of how to use the ghostty-vt render-state API to create a render state, update it from terminal content, iterate rows and cells, read styles and colors, inspect cursor and row-local selection state, and manage dirty tracking.

This uses a build.zig and Zig to build the C program so that we can reuse a lot of our build logic and depend directly on our source tree, but Ghostty emits a standard C library that can be used with any C tooling.

Usage

Run the program:

zig build run