mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 03:25:50 +00:00
The GRAPHEMES_BUF data kind previously required a double pointer (pointer to a uint32_t*) because the OutType was [*]u32, making the typed out parameter *[*]u32. Change OutType to u32 so that callers pass a plain uint32_t* buffer directly, which is the natural C calling convention. The implementation casts the out pointer to [*]u32 internally to write into the buffer. The STYLE data kind read directly from the render state style array without checking whether the cell actually had non-default styling. The style data is undefined for unstyled cells, so this caused a panic on a corrupt enum value when the caller read the style of an unstyled cell. Now check cell.hasStyling() first and return the default style for unstyled cells. Expand the c-vt-render example to exercise dirty tracking, color retrieval, cursor state, row/cell iteration with style resolution, and dirty state reset. Break the example into six doxygen snippet regions and reference them from render.h.
20 lines
551 B
Markdown
20 lines
551 B
Markdown
# 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 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:
|
|
|
|
```shell-session
|
|
zig build run
|
|
```
|