Files
ghostty/example/c-vt-render/README.md
Mitchell Hashimoto 24048ffd47 libghostty: expose row-local render selections
Render state already tracks the selected cell range for each viewport row,
but C renderers could only get the full terminal selection. That required
consumers to map global selection pins back into row-local spans themselves.

Add row selection data to the render-state row API. Querying the new row
data returns GHOSTTY_NO_VALUE for unselected rows and writes the inclusive
start and end columns for selected rows. The render example now demonstrates
setting a selection and reading the row-local range while iterating rows.
2026-05-23 15:03:51 -07:00

575 B

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