# Blog

URL: https://tuios.dev/blog

> Posts about how tuios is built.

## Posts

- [A full scrollback cost 232MB per pane, twice: once in the daemon and once in each client](https://tuios.dev/blog/48mb-per-pane-twice.md): A 112-byte cell made every scrollback line cost the full pane width. Packing cells, then storing lines as text, took a full ring from 232MB to 2.2MB.
- [Agents drive tuios through one-shot commands, so the event bus could not reach them](https://tuios.dev/blog/a-bus-is-not-a-mailbox.md): A hub only reaches whoever is subscribed right now, and agents almost never are. How tuios got a mailbox, ask-agent and an inbox for the person.
- [The pane ran on another machine, and ctrl+D waited for the next keypress](https://tuios.dev/blog/a-pane-on-another-machine.md): tuios daemons now talk to each other over one ssh link per machine. It shipped in stages, and each stage had a bug that taught me something.
- [A PTY has one size, and two clients had two opinions about it](https://tuios.dev/blog/a-pty-has-one-size.md): Two clients on one session each laid the panes out around their own chrome and fought over the shared shells. The fix, and the harness that found the rest.
- [A session switch forgot my column widths](https://tuios.dev/blog/a-session-switch-forgot-my-column-widths.md): Switching sessions and back reset a widened column in the scrolling layout and split stacked panes apart. The daemon's state carried where the strip was scrolled to and nothing about its columns, and the same gap had two clients on one session drawing different widths.
- [Most of a scroll was spent on blank cells](https://tuios.dev/blog/most-of-a-scroll-was-blank-cells.md): A ten-character line scrolling off a 207-column screen walked the whole row twice, once to find the text and once to erase it. One int per row cut the short-line scroll from 1,120 ns to 240 ns. Here is how it was measured on a machine that would not sit still, and how I checked it was still right.
- [Nothing failed, so nothing was fixed](https://tuios.dev/blog/nothing-failed-so-nothing-was-fixed.md): A whole-codebase audit of tuios found a flag nothing set, an interface with one implementation behind 140 call sites, and copies of code that had quietly drifted apart. Dead code survives because nothing fails when it is wrong.
- [Session state was saved every 30 seconds and never read back](https://tuios.dev/blog/sessions-come-back.md): tuios wrote every session to disk from April and no daemon ever loaded it. Wiring up the read side, and then making reattached panes redraw correctly.
- [The one moment an agent needed you was the one moment tuios could not see](https://tuios.dev/blog/the-moment-nothing-could-tell-them.md): A coding agent blocked on a permission prompt paints it once and goes silent. How tuios learned to tell that silence apart from a finished turn.
- [The underline depended on which code drew it](https://tuios.dev/blog/the-underline-depended-on-which-code-drew-it.md): A focused pane dropped SGR underline, and a dimmed, scrolled back or copy mode pane dropped almost every attribute once it lost focus in window mode. tuios had five ways to draw a pane and only one kept everything. The difference only showed when a pane changed paths, usually as focus moved.
- [The screenshot cell was half measured and half guessed](https://tuios.dev/blog/the-cell-was-half-measured.md): Pane screenshots came out stretched. Two rounds of font maths got the cell shape wrong. The fix asks the host terminal for its real cell size in pixels.
- [The renderer was drawing a backlog it had caused](https://tuios.dev/blog/drawing-the-backlog.md): A flooded tuios pane kept painting 1.2 s after its source exited. The client's own renderer caused the backlog, and pacing by queued bytes halved the tail.
- [The fuzzer that found nothing, and the two questions that found everything](https://tuios.dev/blog/the-fuzzer-that-found-nothing.md): 590,000 fuzz runs against the tuios terminal emulator found nothing. They checked the screen was well formed, not right. Two self-checks found real bugs.
- [A fifth of every frame went to changing nothing](https://tuios.dev/blog/a-fifth-of-every-frame-went-to-changing-nothing.md): A profile put 19.8% of the tuios client in lipgloss.Wrap, rewrapping pane text already the right width. Skipping it was easy. Proving the skip safe was the work.
- [My differential tests passed and the screen was pink](https://tuios.dev/blog/my-differential-tests-passed-and-the-screen-was-pink.md): A style cache keyed by recycled libghostty-vt style IDs painted ls output hot pink, and a differential test suite that compared once, at the end, missed it.
- [The daemon said yes to an option that did not exist](https://tuios.dev/blog/the-daemon-said-yes-to-an-option-that-did-not-exist.md): Driving the tuios control socket like a machine found a command that lost its spaces, a dropped parameter, and 88 settings of which six applied live.
- [The bug I closed three times: a speckled sprite in a WebGL terminal](https://tuios.dev/blog/the-bug-i-closed-three-times.md): A speckled sprite in the tuios browser terminal. Three wrong closures, a test suite blind by construction, and a browser that salted its own pixel readback.
- [I dragged one divider and five windows moved](https://tuios.dev/blog/one-divider-five-windows.md): Dragging one divider in the tuios tiling layout moved five windows. It was three defects: neighbours found by geometry, a restarting ease, a truncated ratio.
- [The benchmark said 27x faster. It felt worse.](https://tuios.dev/blog/measuring-before-optimising.md): Fixing pane resize lag in TUIOS with Go benchmarks and pprof. Two of four theories were wrong, and the benchmark measured the wrong thing for three rounds.
- [My fuzzer was optimising for my own bug](https://tuios.dev/blog/fuzzing-a-terminal-test-harness.md): A flaky TUI fuzz suite came down to a PTY line discipline I never configured, and a shrinker that minimised straight toward the race.
- [My multiplexer lied about what it could do](https://tuios.dev/blog/a-terminal-that-lied-about-what-it-could-do.md): kitty icat drew nothing when tuios ran in a browser client. The graphics passthrough said yes to file transmission without asking the host.
- [I ported a correct emoji width table and it fixed nothing](https://tuios.dev/blog/the-width-table-that-changed-nothing.md): Emoji widths were wrong in the tuios browser client. I ported ghostty's per-codepoint width table and nothing changed, because width belongs to clusters.
- [I shipped three fixes for a bug I had not found](https://tuios.dev/blog/three-fixes-for-a-bug-i-had-not-found.md): A tuios pane went blank on focus changes. I shipped three real fixes for other bugs before I reproduced it. The cause was a width read from the first line.
- [Three terminal bugs in one month turned out to be one bug](https://tuios.dev/blog/nobody-was-listening.md): Terminals answer queries like OSC 11 and CPR. Three bugs in three codebases were one bug: the reply was dropped, sent to the wrong place, or echoed.
