Repository navigation
core: resume at the terminal size set while suspended - #2181
Merged
Merged
Conversation
A process stopped with Ctrl+Z gets no SIGWINCH while its shell owns the terminal, and fg sends only SIGCONT. resume() never read the size again, so the renderer came back at the size it was suspended at, and a smaller terminal got a frame too wide and too tall for it. Bun and Node also keep the old stdout size until something calls _refreshSize(). resume() now refreshes the process stdout size and applies it before the first frame. The added lines read that size: nothing else reaches it. Fixes #2158
The size taken on resume applied after native resume had already set the terminal up for the old one. On the main screen it reserved rows for the old height, so a taller resumed frame overwrote the shell's last lines; in a split footer, output captured while suspended went out under a first frame at the old width. It also replaced a size the app had set while suspended with the unchanged terminal size. resume() now applies the terminal's new size, or else the size requested while suspended, before the native resume, and only when the terminal size actually changed. The line that applied a pending size in finishResume() never ran: the transition was still in flight there.
Host::release() read the terminal size only after the session had resumed. Native resume reserves main-screen rows for the renderer's height, so after a resize while released or stopped it reserved rows for the old height: on a terminal grown from 30 to 40 rows it reserved 29 and the first frame overwrote the shell's last 10 lines. It now reads and applies the size before the session resumes, as Core does.
Applying the size requested while suspended at resume skipped two things the normal resize path does. A size the session rejects, such as 0x0, threw out of resume() and left the renderer suspended; it is now reported and dropped, and resume continues at the last accepted size. The flag that marks a pending size as a change stayed set, so a later request for the same size forced a full repaint; it is now cleared with the pending size.
simonklee
added a commit
that referenced
this pull request
Nov 26, 2026
Two models could not reach the Markdown list crash (#2199) or the stale size after resume (#2181). Each now generates the input its bug needed and finds the bug with the fix reverted. Builds on the duplicated code block fix, which the new input found; merge that first. The Markdown model switches `renderBlock` between four renderers, two of which take over code blocks; it finds #2199 at seed 985. P7 and P8 now also skip a line starting with "```" whose info string holds a backtick: CommonMark makes that no fence, so the run may still close as a code span while streaming. The session simulation resizes the terminal while suspended, without a SIGWINCH, and checks the resumed renderer's size; 31 of 170 rows fail without the #2181 fix. CI time grows by about 0.2 s.
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.
A TUI suspended with Ctrl+Z came back after
fgat the size it was suspended at when the terminal was resized inbetween. A smaller terminal got a broken frame, and on the main screen a taller one lost the shell's last lines under
the first frame. While the job is stopped the shell owns the terminal, so the process gets no SIGWINCH, and
fgsendsonly SIGCONT. Bun and Node also keep the old
process.stdoutsize until it is refreshed.resume()now refreshes the size and applies it before the terminal is set up again, so the first frame, thereserved main-screen rows and the split footer all use it. A size the app set while suspended still wins if the
terminal did not resize. Rust's
Hostnow reads the size before resuming too.Tested in existing renderer and split-footer suites and in a real pty.
Reported by @bew. Fixes #2158