Conversation
Output produced while a prompt is up now waits for the answer instead of landing in the middle of the question. A tool result arriving from a parallel tool, a title generator finishing, an MCP server logging to stderr: each used to print straight over the widget's frame, on a terminal in raw mode where a line feed no longer returns to column zero. The same holds while an external `$EDITOR` has the screen. A handover is bracketed by the guard `suspend_status` and the prompt writers already take, so the printer now knows exactly when the terminal is not its own. For that window the worker keeps ordinary output in a queue and writes it, in the order it was produced, once the terminal comes back. Handovers nest, and only the outermost hand-back releases anything: a permission prompt opening the inline reply widget on top of itself never gives the screen away mid-question. A print task says who it belongs to, and only a prompt session's own writes reach a terminal someone else owns. Nothing is dropped: if a run ends with a widget still holding the terminal, whatever it was holding back is written on the way out, because that output is the answer the user asked for and an untidy final frame is the smaller loss. Signed-off-by: Jean Mertz <git@jeanmertz.com>
`ansi` and `shade` move from `jp_md` to `jp_term`, along with the region-background types they interpret, which land in a new `jp_term::background`. Nothing about what they do is markdown: `segments` tokenizes an escape stream, `AnsiState` tracks what a stream left active, and `ShadedWriter` keeps a background showing across cursor rewrites and split escapes. `jp_md` gains a `jp_term` dependency and imports them like any other consumer. The move puts them where the printer can reach them. `jp_printer` depends on `jp_term` and deliberately not on `jp_md`, so shading a prompt meant either pulling a markdown renderer into the output layer or writing the state machine a second time. `DefaultBackground`, `BackgroundFill`, and `line_fill` leave `jp_md::format` for `jp_term::background`, so the types and the one place that interprets them travel together. `AnsiState`'s methods widen from `pub(crate)` to `pub` now that its callers are in another crate. Signed-off-by: Jean Mertz <git@jeanmertz.com>
A tool call made from a reasoning block sits inside that block's shading, and its prompts now do too. The approval prompt and the tool's questions were already shaded; the inline reply widget, reached by `e` to edit arguments or `r` to skip with a reason, was not, and cut an unshaded hole in the middle of the block. The printer knows which background prompts are drawn against, and applies it to every prompt writer it hands out. Whoever owns the region names it once and no prompt site has to remember: `Printer::set_prompt_background` replaces the copy `ToolPrompter` was keeping, and the shaded-writer plumbing that lived beside it in `jp_cli` is gone. The owned prompt writer, which is the one the reply widget takes, is covered by the same code as the borrowed one rather than needing its own. Closes: T-0fg8cjs Signed-off-by: Jean Mertz <git@jeanmertz.com>
`T-0fg8cjs` records where the shading landed, why `ansi` and `shade` had to move crates to get there, and the two things found on the way: the swallowed flush that made prompt output staircase inside a reasoning block, and a mock reply widget that wrote nothing to the stream it was handed. `T-0fk64t3` records what the move exposed. `jp_term` holds two implementations of display width that arrived from different directions and have never been compared, one of which knows about tabs and one of which does not. Signed-off-by: Jean Mertz <git@jeanmertz.com>
JeanMertz
force-pushed
the
prompt/shading
branch
from
September 8, 2026 21:43
6ad9adb to
00a9cd5
Compare
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 tool call made from a reasoning block sits inside that block's shading,
and its prompts now do too. The approval prompt and the tool's questions
were already shaded; the inline reply widget, reached by
eto editarguments or
rto skip with a reason, was not, and cut an unshaded holein the middle of the block.
The printer knows which background prompts are drawn against, and applies
it to every prompt writer it hands out. Whoever owns the region names it
once and no prompt site has to remember:
Printer::set_prompt_backgroundreplaces the copy
ToolPrompterwas keeping, and the shaded-writerplumbing that lived beside it in
jp_cliis gone. The owned promptwriter, which is the one the reply widget takes, is covered by the same
code as the borrowed one rather than needing its own.
Closes: T-0fg8cjs
Signed-off-by: Jean Mertz git@jeanmertz.com