mirror-ghostty/include
Daniel Gräfe 87afeaaf0a Cache AccessibilityContext to eliminate redundant PinMap builds
Each accessibility C API call (ax_bounds, ax_offset, ax_cursor_offset)
previously rebuilt the entire StringMap independently — O(total_bytes)
allocation and work per call. VoiceOver fires multiple queries per
interaction, so this was wasteful.

Introduce AccessibilityContext: a pre-computed, self-contained snapshot
built once per cache window (~500ms). It contains the terminal text,
viewport byte range, cursor offset, per-byte viewport cell info, and a
grid-to-offset lookup table. All data is owned (no raw Pin pointers),
so it is safe to cache in Swift without holding the terminal mutex.

The C API now exposes context lifecycle functions
(ghostty_surface_ax_context_new/free) and query functions that accept
the context handle. The Swift layer wraps the context pointer in an
AXContextHandle class so ARC frees it when the CachedValue expires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 14:48:47 +01:00
..
ghostty lib-vt: fix up the OSC command keys 2026-01-23 14:42:05 -08:00
ghostty.h Cache AccessibilityContext to eliminate redundant PinMap builds 2026-03-05 14:48:47 +01:00
module.modulemap include: comment the modulemap 2023-02-19 10:44:53 -08:00