Conversation
The question prompt grew to whatever height its content needed, so a long question covered the transcript and hid the work the agent had just done. The only escape was to dismiss the prompt and ask the agent to repeat itself. The body also had no scroll region, so text past the viewport was unreachable. Bound the panel to a proportional share of the terminal and move the question body into a scrollbox. Options and controls stay fixed below it. Size the body to the rows it actually renders rather than to the full budget, otherwise a one-line question still reserves the maximum and leaves a wide gap above the options. Counting has to account for the sidebar, which auto-opens past 120 columns and takes 42 of them, and for wrapping, since one long paragraph occupies many rows. The estimate rounds up: undercounting clips the body, overcounting only leaves the scrollbox some slack. Fixes anomalyco#37173
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #37173
Type of change
What does this PR do?
The question prompt grows to fit its content. Ask a long question and it covers the transcript, hiding the work the agent just did, which is the context you need to answer. #37173 describes where that leaves you: hit escape to read anything, which cancels the questions, then ask the agent to repeat itself. The body doesn't scroll either, so anything past the viewport is just gone.
So the panel is capped now, and the question body sits in a scrollbox. Options and controls live outside it with
flexShrink={0}and stay put.Capping it alone gives you the opposite problem. A one-line question reserves the whole budget and leaves a gap above the options, 14 rows for 1 row of text on a 40-row terminal. So
maxHeighton the scrollbox is whichever is smaller, the budget or the rows the question actually renders.Two things make that row count wrong if you skip them. The sidebar opens on its own past 120 columns and eats 42, so the question is rendering into a narrower column than
dimensions().widthimplies (same math ascontentWidthinsession/index.tsx). And a long paragraph wraps over many rows, so the count divides by that width and rounds up, since wrapping breaks on whitespace and not at the exact boundary. Round down and you clip the body. Round up and the scrollbox has a little slack, which nobody notices.The history reserve is a percentage, not a fixed row count. Fixed starved the body on short terminals.
Worth flagging: #37173 asks for a show/hide toggle. This goes the other way and keeps enough context on screen that there's nothing to toggle. Say the word if you'd rather have the explicit control.
How did you verify your code works?
Rendered
QuestionPromptwithtestRenderat fixed sizes and readviewport.heightandscrollHeightoff the scrollbox. Marker line above the prompt to confirm history survives:History, options and controls stayed on screen in all six. Before the change the two short cases reported a viewport of 14 for 1 row of content.
Then a real session: failing command, then a ~1200 word question. Error stays visible, body scrolls, options don't move. Short question sits right on top of its options with no gap.
bun typecheckpasses inpackages/tui.One thing if this code ever moves. The new memos read
multi()and are declared after it. Solid evaluates memos eagerly at setup, so pointing at a laterconstthrows a temporal dead zone error at runtime andtscsays nothing. Found that the hard way.Screenshots / recordings
Short question, after. Text sits directly on its options:
Long question, after. Failing command still visible above, scrollbar mark on the right, options pinned:
Before the fix the short case had 13 blank rows sitting between the question text and option 1.
Checklist