mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-07 20:34:29 +00:00
vt: fix render state cell style and graphemes_buf APIs
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.
This commit is contained in:
@@ -58,10 +58,26 @@ extern "C" {
|
||||
* reset the row-level dirty flags. So, the caller of the render state API must
|
||||
* be careful to manage both layers of dirty state correctly.
|
||||
*
|
||||
* ## Example
|
||||
* ## Examples
|
||||
*
|
||||
* ### Creating and updating render state
|
||||
* @snippet c-vt-render/src/main.c render-state-update
|
||||
*
|
||||
* ### Checking dirty state
|
||||
* @snippet c-vt-render/src/main.c render-dirty-check
|
||||
*
|
||||
* ### Reading colors
|
||||
* @snippet c-vt-render/src/main.c render-colors
|
||||
*
|
||||
* ### Reading cursor state
|
||||
* @snippet c-vt-render/src/main.c render-cursor
|
||||
*
|
||||
* ### Iterating rows and cells
|
||||
* @snippet c-vt-render/src/main.c render-row-iterate
|
||||
*
|
||||
* ### Resetting dirty state after rendering
|
||||
* @snippet c-vt-render/src/main.c render-dirty-reset
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user