terminal: add visibility reports

Applications cannot infer whether an unfocused terminal remains visible, so
focus reports are insufficient for avoiding expensive rendering while a
view is hidden.

Implement private mode 2033 and the visibility query/report sequences.
Track conservative per-surface visibility, report every effective change
while enabled, and always answer explicit queries and mode enables. Keep
view visibility across terminal resets because it is owned by the host,
not terminal state.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019fa965-aa5f-7099-85b4-a9679d2c8bd3
This commit is contained in:
Tim Culverhouse
2026-07-26 13:56:14 -05:00
parent 2f3814ca5e
commit 6c8c07981d
10 changed files with 187 additions and 1 deletions

View File

@@ -313,6 +313,11 @@ fn drainMailbox(
log.debug("mailbox message={s}", .{@tagName(message)});
switch (message) {
.color_scheme_report => |v| try io.colorSchemeReport(data, v.force),
.visibility_report => |v| try io.visibilityReport(
data,
v.visible,
v.force,
),
.crash => @panic("crash request, crashing intentionally"),
.change_config => |config| {
defer config.alloc.destroy(config.ptr);