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

A Tab Is a Moveable Tree

~12 min · tab, drag, tear-off, tree, identity

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

Move the Tree, Not the Picture

A tab is not a row of titles glued to a screenshot of panes. It is the tree: pane controllers, PTY attachments, title, color, focused pane. Drag-reorder inside a window, tear-off into a new window, drop onto another window — the tree has to survive the move. If drag copies pixels and starts new processes, you did not move a tab. You cloned a look and orphaned the jobs.

That is why the last lesson insisted the pane is an object. Objects can be reparented. Pictures have to be redrawn from scratch, which means new PTYs, which means placeholder shells, which means the compiler you were in the middle of is still in the old window while a fresh zsh blinks at you in the new one. Living in a terminal is moving work around. If move is clone, you stop moving, and the bar from Track 1 starts collecting dated rows.

No Placeholder Shell, No Synthetic Enter

A move that cannot take the PTY along will be tempted to cheat: spawn a shell in the destination, maybe cd to the old directory, maybe synthesize Enter so it looks ready. That cheat is a model-shaped write wearing a drag gesture. The new pane is not the old job. It is a lookalike. Smolder refuses the lookalike. If the tree cannot move, the drag fails. It does not invent a process and type into it.

Synthetic Enter is the same sin the door track will name for Anvil drafts and Pippa proposals. A newline the operator did not press is how you submit the wrong thing into the wrong brain. A drag is not an operator pressing Enter. The destination of a moved tab should light up on the jobs you already had, idle, waiting, not racing a fabricated prompt.

Cross-Window Is Still One Owner

Two windows are two projections of the same daemon. Moving a tab across them is reparenting a tree from one projection to another, not shipping a process to a new owner. The daemon already owned the PTYs. The app is rearranging which glass shows them. Tear-off that started a second daemon would be a second factory, and quit of either window would become ambiguous: whose jobs, whose journal, whose restore.

Reorder inside a window is the small case of the same fact. The tab strip is a list of trees. Dragging a title along the strip changes list order, not process identity. If order were stored only as pixels, restore would not know which tree was which. Identity rides the object, so a moved tab is still itself when you come back from lunch.

A tab is a tree you can drag. The jobs survive. Placeholder shells and synthetic Enter are how a move becomes a clone, and a clone is how you lose the job you thought you moved.

Code

What has to travel with a drag·text
drag payload = the tab tree, not a screenshot
  - each leaf's pane controller
  - each leaf's PTY attachment (same daemon, same process)
  - title, color, focused leaf
  - split ratios

# Legal destinations
  reorder in this window's tab strip
  tear-off -> new window, same daemon
  drop onto another window, same daemon

# Illegal compensations when a move cannot take the PTY
  spawn a placeholder shell
  cd to the old directory and hope
  synthesize Enter so the prompt looks "ready"
  copy pixels into a new emulator and call it the same tab

# If the tree cannot move, the drag fails.
# Failure is honest. A lookalike is not.

External links

Exercise

Describe a three-pane tab you would tear off onto a second monitor. List five things that must still be true in the new window (processes, focus, titles, ratios, journal). Then list two cheats a scared implementation might try if it could not move the PTYs, and one sentence you would write on the refusal for each cheat.
Hint
If a compiler PID changed, you cloned. If a newline appeared that nobody pressed, you submitted. Both are failed moves, even if the screenshot matches.

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 inPlease sign in to comment.

No comments yet — be the first.