mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-26 06:48:33 +00:00
Add a C API for tracked pins, known as a tracked grid ref in C. The new API can create tracked refs from terminal points, snapshot them back to regular grid refs for cell access, convert them to coordinates, move them to a new point, report when their semantic location was lost, and free the tracked pin bookkeeping. This is backed by PageList tracked pins and exposed through the libghostty-vt export layer and headers.
20 lines
609 B
Markdown
20 lines
609 B
Markdown
# Example: `ghostty-vt` Tracked Grid References
|
|
|
|
This contains a simple example of how to use the `ghostty-vt` terminal and
|
|
tracked grid reference APIs to keep a long-lived reference to a cell as the
|
|
terminal scrolls, detect when that reference loses its meaningful location,
|
|
and move the same tracked handle to a new point.
|
|
|
|
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
|
|
```
|