writeonce/docs/stories/runtime-v2/06-term-size-width.md
shoney.arickathil 5e8e0960bc feat(rt2): term.size + term.width — the wmux ladder's last runtime asks
- term.size(fd) -> ?TermSize{cols,rows}: TIOCGWINSZ, resize's read twin;
  nil = not a tty (expected answer, never a trap)
- term.width(cp): libc wcwidth under C.UTF-8 (LC_CTYPE set on first
  use, host-locale fallback): -1 control, 0 combining, 1, 2
- ids 108/109 (all four registrations); TermSize predeclared
- legs: PTY sized 77x33 from outside answers exactly that, pipe answers
  nil, widths a/CJK/combining/BEL = 1/2/0/-1; test_term 81/0, woc 557/0
- story runtime-v2 6 recorded done; board row appended

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 1514fb46c21c4318856cfcb3ca2b4d430caba72b)
2026-09-15 01:15:30 +02:00

24 lines
1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
track: runtime-v2
iteration: "6"
status: done
readiness: ready
---
# runtime-v2 6 — term.size and term.width: the two verbs the wmux ladder asked for
> Part of [Story — runtime-v2: the runtime beyond sockets](00-story.md).
> Named by the wmux parity-ladder brainstorm (2026-09-02) as the ONLY
> runtime work all nine wmux rungs need beyond the landed track.
>
> **DONE 2026-09-02, same day.** `term.size(fd) -> ?TermSize {cols,
> rows}` — TIOCGWINSZ, the resize verb's read twin; nil = not a tty (an
> expected answer, never a trap). `term.width(cp) -> Int` — libc
> `wcwidth` under `C.UTF-8` (first use sets `LC_CTYPE`; falls back to
> the host locale): -1 control, 0 combining, 1, 2. Ids 108/109;
> `TermSize` joins the predeclared records. Consumers: wmux 1 (attach
> at the client's real size), wmux 2 (grid column math), wmux 6
> (multi-client min-size, SIGWINCH forwarding).
>
> Legs in `test_term.c`: a PTY sized 77×33 from outside answers exactly
> that; a pipe answers nil; widths a=1, U+4E2D=2, U+0301=0, BEL=-1.