mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-06 07:38:21 +00:00
vt: add GhosttyRenderStateRowCells opaque type
Add a new opaque RowCells type that wraps per-row cell data (raw cells, graphemes, styles) for the C API. The caller allocates a RowCells handle via row_cells_new, then populates it by passing it to row_get with the new .cells data kind. This queries the current row from the iterator and slices the underlying MultiArrayList into the RowCellsWrapper fields. The new type and functions are wired through main.zig, lib_vt.zig, and the render.h C header.
This commit is contained in:
@@ -79,6 +79,13 @@ typedef struct GhosttyRenderState* GhosttyRenderState;
|
||||
*/
|
||||
typedef struct GhosttyRenderStateRowIterator* GhosttyRenderStateRowIterator;
|
||||
|
||||
/**
|
||||
* Opaque handle to render-state row cells.
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
typedef struct GhosttyRenderStateRowCells* GhosttyRenderStateRowCells;
|
||||
|
||||
/**
|
||||
* Dirty state of a render state after update.
|
||||
*
|
||||
@@ -138,6 +145,10 @@ typedef enum {
|
||||
|
||||
/** The raw row value (GhosttyRow). */
|
||||
GHOSTTY_RENDER_STATE_ROW_DATA_RAW = 2,
|
||||
|
||||
/** Populate a pre-allocated GhosttyRenderStateRowCells with cell data for
|
||||
* the current row (GhosttyRenderStateRowCells). */
|
||||
GHOSTTY_RENDER_STATE_ROW_DATA_CELLS = 3,
|
||||
} GhosttyRenderStateRowData;
|
||||
|
||||
/**
|
||||
@@ -370,6 +381,36 @@ GhosttyResult ghostty_render_state_row_set(
|
||||
GhosttyRenderStateRowOption option,
|
||||
const void* value);
|
||||
|
||||
/**
|
||||
* Create a new row cells instance.
|
||||
*
|
||||
* All fields except the allocator are left undefined until populated
|
||||
* via ghostty_render_state_row_get() with
|
||||
* GHOSTTY_RENDER_STATE_ROW_DATA_CELLS.
|
||||
*
|
||||
* You can reuse this value repeatedly with ghostty_render_state_row_get() to
|
||||
* avoid allocating a new cells container for every row.
|
||||
*
|
||||
* @param allocator Pointer to allocator, or NULL to use the default allocator
|
||||
* @param[out] out_cells On success, receives the created row cells handle
|
||||
* @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation
|
||||
* failure
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
GhosttyResult ghostty_render_state_row_cells_new(
|
||||
const GhosttyAllocator* allocator,
|
||||
GhosttyRenderStateRowCells* out_cells);
|
||||
|
||||
/**
|
||||
* Free a row cells instance.
|
||||
*
|
||||
* @param cells The row cells handle to free (may be NULL)
|
||||
*
|
||||
* @ingroup render
|
||||
*/
|
||||
void ghostty_render_state_row_cells_free(GhosttyRenderStateRowCells cells);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user