fix: create boo ui sessions at the viewport size#73
Merged
Conversation
New sessions in `boo ui` were created with `boo new -d`, which starts the session daemon's PTY and ghostty terminal at the default 24x80. The UI only corrected the size on attach, so a freshly created session was born at the wrong geometry: its first prompt and early output were laid out at 24x80 until the next resize. Add --rows/--cols to `boo new` and have the UI pass the viewport size at creation, so a session is born at the geometry it will be shown at. The attach handshake still resizes, so reconnects and races stay correct.
BenLocal
added a commit
to BenLocal/boo
that referenced
this pull request
Jun 18, 2026
Brings in upstream coder#73 (boo ui sessions created at the viewport size), coder#74 (capture held prefix keys via kitty release events), coder#75 (scrollback replay on attach), and the v0.5.21/v0.5.22 releases. Conflict resolution: - main.zig / daemon.zig: union the createSession / runDaemon / Options params — self's state_dir/cwd/max_scrollback (restore + config) plus main's rows/cols (viewport-size fix). restoreOne passes null rows/cols. - scrollback replay (ui.zig, daemon.zig, protocol.zig, client.zig): self and main implemented the same feature two ways. Kept main's design (a separate `.ui` marker message before a SizePayload attach) and dropped self's redundant AttachPayload.ui flag, so client and daemon agree on the wire. - window.zig: kept self's added alt-screen historyReplay test. Verified: zig fmt, zig build, unit tests, and PTY integration tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A newly created terminal in
boo uiappears at the wrong height until the terminal is resized. Reported repro: open a new session, runcurl https://coder.com, and the output overflows the viewport.Root cause
boo uicreates sessions by shelling out toboo new -d. That path starts the session daemon's PTY and ghostty terminal at the daemon default 24x80 (no size is ever passed in), and the UI only corrects the size when it attaches. So a freshly created session is born at the wrong geometry: its first prompt and any early output are laid out at 24x80 until the next resize re-runs layout. That is the "wrong until I resize" behavior.Fix
boo newgains--rows/--colsto set the session's initial terminal size (the 24x80 default is unchanged when the flags are absent).boo ui'screateSessionpasses the current viewport size, so a session is born at the geometry it will be displayed at.Validation
boo new -d --rows 30 --cols 100session reports30 100fromstty sizeinside the child, with no attach, proving the size reaches the PTY at creation. (Sanity-checked by deliberately asserting the wrong value and confirming it fails reporting the real30 100.)boo uiunder a PTY + VT emulator: new sessions are born at the viewport size (e.g. 40 rows x 85 cols in a 40x110 terminal) andcurloutput stays within the viewport.zig fmt --check,zig build test, andzig build test-integrationall pass.Investigation & decision log
How I traced it
boo uirenders sessions in a sub-viewport (full terminal height,cols - sidebar - 1).createSessionrunsboo new -d;runDaemon->Daemon.runnever setsrows/cols, soOptionsdefaults to 24x80 and the child PTY + ghostty terminal are born at 24x80..attach(then repaints) and.resize. Both the daemon term and the PTY winsize are updated, and libghostty's grow/shrink (including scrollback reflow) is robust, so the final state is correct after attach.Honest note on reproduction
I was not able to reproduce a persistent visual overflow on Linux: in a real-PTY + VT-emulator harness at 16/40/50 rows, with both
seqoutput and the literalcurl https://coder.com, the attach resize always corrected the final frame and content stayed within the viewport. What is unambiguously wrong is the birth size: the session (and its child process's first output) starts at 24x80 and is only corrected on attach. That is the exact mechanism behind "new terminal is wrong until I resize," so this change fixes the root cause; the residual visible artifact on the reporter's setup is likely terminal/timing dependent (first-frame reflow, delayed SIGWINCH). Happy to dig further with the reporter's terminal + size if it persists after this.Scope
boo new/boo attachare intentionally left on the existing attach-handshake sizing: they render the daemon's screen 1:1 in the real terminal, so the transient is invisible there.--rows/--colsare also useful for automation (creating a headless session at a known size).This PR was generated by Coder Agents on behalf of @kylecarbs.