Repository navigation
test(painter): assert on a vt100 screen instead of emitted bytes - #1249
Merged
kronberger-droid merged 2 commits intoOct 18, 2026
Merged
Conversation
The wide grapheme test asserted where `vt100` wraps a grapheme that does not fit. The painter prints it raw and restores the position the terminal reached, so both the row and the cursor were the emulator's choice; the painter's own model of that wrap is covered by `deferred_wrap_row_on_wide_graphemes`. The two ignored repros now go green only on a full fix: the large buffer one tolerates a scroll on the first paint, and the trailing newline one also checks the cursor column and click mapping against the screen, so fixing `prompt_height` alone keeps it red.
kronberger-droid
marked this pull request as ready for review
October 18, 2026 12:20
This was referenced Oct 18, 2026
fdncred
pushed a commit
to nushell/nushell
that referenced
this pull request
Oct 18, 2026
## Description Bumps reedline to `39db5e3`, six PRs past `d704744`: - nushell/reedline#1132 `feat(engine): add opt-in paste hooks for interception and burst detection` - nushell/reedline#1243 `fix(painter): print external messages from the prompt's start row` - nushell/reedline#1249 `test(painter): assert on a vt100 screen instead of emitted bytes` - nushell/reedline#1247 `chore: add .claude to gitignore` - nushell/reedline#1248 `feat(history)!: drop chrono from the public API with a millisecond HistoryTimestamp` - nushell/reedline#1254 `Fix large completion menus and synchronized repainting` #1248 needs the only change on the nushell side: `repl.rs` now stamps history with `HistoryTimestamp::now()`, and `history import` converts its `date` field to millis, so its input type stays the same. ## User-facing changes (Release notes) - Fixed external messages leaving prompt rows behind or erasing output above the prompt. - Fixed completion menus with more entries than fit in terminal coordinates. - Repaints are bracketed with synchronized terminal updates, which reduces flicker on supporting terminals.
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.
Summary
Painter tests so far assert on the escape bytes the painter emits, or replay them through the small hand-written emulator in
painter.rs(replay).Bytes say little about what reaches the screen, and they break on any reordering that is correct.
Worse, the expected rows usually come from the same layout math under test, so the painter ends up being its own oracle.
This adds
vt100as a dev-dependency and a thinTestScreenwrapper over it (src/painting/test_screen.rs).A test paints into the capture writer, feeds the bytes through
TestScreen, and asserts on rows, the cursor, cursor visibility and how many rows scrolled into history.Tests only talk to
TestScreen, so the emulator can be swapped by changing that one file.src/painting/painter/screen_tests.rshas the first tests on it.They build
PromptLinesthroughPromptLines::newthe way the engine does, so a new field onPromptLinesdoes not reach them.No public API change, everything is
#[cfg(test)].The only non-test change is the
vt100dev-dependency inCargo.tomlandCargo.lock(MSRV 1.70, below ours).Before
Painter tests check byte strings such as
\x1b[?25h\x1b[J\r\n, or a screen rebuilt byreplay, which only models the sequences the painter happened to use when it was written.After
Painter tests can state what the user sees:
Additional notes
Neither is filed yet, i will open issues for them and fix them separately.
Where
vt100is just one opinion: it keeps a deferred wrap across DECSC/DECRC and wraps a wide grapheme early with one column left.The module doc says so, tests should assert that the painter stays out of such cases rather than on how
vt100resolves them.Out of scope:
replaybased tests and removingreplay, follow up.