mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-25 00:35:23 +00:00
example: add grid reference traversal example
Add a c-vt-grid-ref example that demonstrates the terminal and grid reference APIs end-to-end. The example creates a small 10x3 terminal, writes text with mixed styles via VT sequences, then iterates over every cell in the active area using ghostty_terminal_grid_ref. For each cell it extracts the codepoint, and for each row it inspects the wrap flag and the style bold attribute. The grid_ref.h defgroup gains a @snippet reference to the new example, and vt.h gets the corresponding @example entry and @ref listing.
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
* - @ref c-vt-paste/src/main.c - Paste safety check example
|
||||
* - @ref c-vt-sgr/src/main.c - SGR parser example
|
||||
* - @ref c-vt-formatter/src/main.c - Terminal formatter example
|
||||
* - @ref c-vt-grid-traverse/src/main.c - Grid traversal example using grid refs
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -84,6 +85,11 @@
|
||||
* contents as plain text.
|
||||
*/
|
||||
|
||||
/** @example c-vt-grid-traverse/src/main.c
|
||||
* This example demonstrates how to traverse the entire terminal grid using
|
||||
* grid refs to inspect cell codepoints, row wrap state, and cell styles.
|
||||
*/
|
||||
|
||||
#ifndef GHOSTTY_VT_H
|
||||
#define GHOSTTY_VT_H
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ extern "C" {
|
||||
* built to sustain the framerates needed for rendering large screens.
|
||||
* Use the render state API for that.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* @snippet c-vt-grid-traverse/src/main.c grid-ref-traverse
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user