Skip to content
C.W.K.
Stream
Lesson 03 of 10 · published

The Grid Follows the Typist

~12 min · resize, viewport, shared-input, sigwinch, phone

Level 0Spark
0 XP0/48 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

One PTY Has One Size

Many surfaces can type into a session, but the session's PTY still has exactly one width and one height, and every TUI inside it lays itself out for that size. So someone has to decide it. Under the old lease the answer was the lease holder. Under the shared contract the answer is shorter to say and sharper to live with: the grid follows the last surface that typed or explicitly claimed its size — My size on the phone, a real layout change on the Mac. Every other surface renders that grid as it stands.

Attaching Never Resizes

The rule from Track 5 survives intact and becomes the floor of this one: opening a session never changes its size. A phone that attaches to a 120-column Mac session draws 120 columns — fitted to the glass, or at full size so you pan across it — and the TUI on the Mac does not reflow. An observer can never resize at all. A Mac pane joining a session where another surface is already typing leaves the size out of its attach request and keeps the owner's grid through replay and through a hold being released. Rotation is the same: the glass changed, the PTY did not.

Typing Carries Your Viewport

What changes the grid is input. Every keystroke a surface sends carries that surface's own viewport — for the phone, the grid its canvas would hold at 100% — and the daemon moves the PTY to it. The other surfaces receive a viewport change and draw the new grid. The phone also has an explicit My size button for asking without typing. On the Mac, a pane that has been drawing a grid another surface chose takes its own size back on its next keystroke or on a real layout change.

This has a price, and the lesson should say it plainly. Type one letter on the phone into a session the Mac was showing at 160 columns, and every TUI in that session reflows to phone width; type one letter back on the Mac, and it reflows again. That is the honest consequence of letting both glasses type without ceremony. The alternative — a size nobody can change, or a size only a lease holder can change — is the friction Dad ruled out.

Fit and 100% Are Drawing, Not Asking

The pane strip on the phone carries a drawing toggle. When the host grid is wider than the glass, the phone can fit it, scaling the cells down so the whole width shows, or show it at 100% so the cells are readable and you pan; the button names the mode it will switch to, so a fitted pane offers 100%. Neither sends anything to the daemon. Only typing, My size and a real Mac layout change do. Keep those two families in different code paths and the old rule holds: looking never resizes; typing may.

Attaching never resizes; the grid follows whoever typed or asked last. Every other surface renders that grid. Fit and 100% change only how one glass draws it.

Code

What may change the PTY's size, and what may not·text
may NOT resize the PTY
  attaching (phone, iPad, another Mac pane)
  an observation-only device, ever
  phone rotation, iPad split view, Stage Manager resizing
  Fit / 100% on the phone            (drawing only)
  replay, and the release of a hold  (a joining Mac keeps the owner's grid)

may resize the PTY (the grid follows the latest one)
  input from any surface   -> carries that surface's viewport
                              phone: the grid its canvas holds at 100%
  phone "My size"          -> asks for its viewport without typing
  Mac pane: its next keystroke, or a real layout change (window resize, split)

everyone else
  receives a viewport change, renders that grid (fit, or 100% and pan)

cost, stated
  phone types one letter -> every TUI in the session reflows to phone width
  Mac types one letter   -> it reflows back

External links

Exercise

A Mac session is 160x45 with an editor open. A phone attaches, then you rotate it, then you type one character on it, then you type one character on the Mac. Write the PTY's size after each of the four steps and which glass, if any, asked for it.
Hint
Two of the four steps change nothing. The size is set only by someone typing (or pressing My size, or reshaping a Mac pane).

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.