0225. Presented metadata and measured scroll diff
- Status: Accepted for M-TUI.5b/M-TUI.8 implementation
- Date: 2026-11-12
Approval review exposed a race: a feed can add a prompt at5ms and a key at6ms before the16ms render deadline. Recomputing a future view cannot prove the user saw it. Runtime therefore delivers Presented(finalFrame) before the next input, after the effectful shell writes the preceding output. Stats carries measured frame/row/byte counts. These metadata events update state without implicitly scheduling output; this avoids a metrics-render feedback loop at idle.
A measured80×30 wrapped transcript changed27 logical rows and emitted2208bytes after one character, exceeding the streaming budget. DESIGN explicitly defers scroll regions until a benchmark proves their need. The encoder now selects a stable exact-row shift with at least three saved rows, emits bounded scroll margins and CSI S/T, resets the margins, then diffs against the shifted frame. Headers and footers remain outside the selected region. Seeded independent VT round trips cover the resulting commands. Logical row changes and emitted rows are distinct counters; acceptance gates the latter and exact output bytes.
Core focus traversal recognizes the known CSI-u Tab
press/repeat control, while enhanced releases and unknown CSI-u
keys remain raw for the keyboard package. This keeps global Tab
traversal ahead of application decoding without making the core
depend on tui_keys; the plugin handles the rest of
Kitty decoding.