Repository navigation
Conversation
tony
pushed a commit
that referenced
this pull request
Dec 2, 2026
why: Checking only whether the viewport reached its bottom row still resurrects pre-clear scrollback when post-ED 2 output fills the screen with a multi-row soft-wrap or shrinks by more rows than scrolled since the clear (#145, #149). what: - Track monotonic _viewport_clear_at on Screen and Snapshot across full primary-screen erases, resets, and primary reflow - Sever orphaned pre-clear soft-wraps at _viewport_clear_at during Screen._reflow_primary - Bound prefix_hist and scrollback pullback in _serialize_extracted by min_hist_idx derived from _viewport_clear_at - Expand tests/test_testing.py across DEFAULT_PROFILE, tmux_profile(), and resize(reflow=True), and reference #149 in CHANGES
why: A wrapped temporary path can displace earlier rows in full-screen
output.
what:
- Fill the vacated rows when a scrubber collapses wrapped output
- Cover single-path and multiple-path screen captures
This was referenced Dec 3, 2026
why: A fully redrawn viewport can still have unrelated output before an
erase.
what:
- Track the display clear boundary for reflow and scrubbing
- Check post-clear wrapping under default and tmux profiles
why: Erased or overwritten leading cells must leave the earlier
scrollback line separate.
what:
- Sever incoming wraps during erases and heal split wide cells
- Keep frozen history and change tokens consistent
- Replay synthetic wraps with ECH and exercise screen erases
why: Widening after an in-place erase must preserve the fresh viewport,
retained history, and its protected wide cells.
what:
- Preserve the history break and viewport padding during reflow
- Apply the profile's erase policy and honor protected wide glyphs
- Freeze synchronized frames before public Screen edits
- Cover the resize, protected erase and host profile behavior
why: Scrubbing needs to preserve the captured rows, columns and cursor
even when replacement text changes width.
what:
- Apply scrubbers one row at a time within the captured viewport
- Measure replacement cells with the source profile and crop
- Cover clipped wide cells, stored graphemes and fixed-width fields
- Document how to keep temporary paths on one captured row
tony
force-pushed
the
fix/145-scrubber-scrollback-pullback
branch
from
December 3, 2026 02:48
97e7b01 to
2d1b6fe
Compare
This was referenced Dec 3, 2026
This branch was successfully deployed
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
Terminal.changes_since()resyncshistory[-1]without mutating earlier CoWSnapshotinstances, and emitECH(\x1b[X) instead ofEL 0(\x1b[K) inFormatterVT wrap replay. The Ghostty profile retains incoming wraps across the applicable erases.In
v0.0.1a5, erasing row0in place underDEFAULT_PROFILE(ed2_scrolls_primary_to_history=False) clears row0's cells without clearinghistory[-1].wrapped. SubsequentTerminal.resize(..., reflow=True)can join post-clear text at(0, 0)to the pre-clear scrollback row. Snapshot scrubbing also needs to preserve the captured frame when a replacement changes a row's width.Fixes #153
Closes #145
Closes #85
Closes #143
Feed
b"abcdefghijklmnopqr\x1b[2J\x1b[HFresh"into an 8×2 terminal, serialize the box withscrubbers=[("Fresh", "OK")], and widen to 16 columns withreflow=True.Before (
v0.0.1a5):After:
Changes by area
Screen & history wrap severing
src/libvt/_grid.py: add_HistoryBuffer.sever_last_wrap()to clearwrappedand any trailingSPACER_HEADonhistory[-1]via CoW block or tail replacement while preserving frozenSnapshothistory rows.src/libvt/screen.pyandsrc/libvt/config.py: preserve viewport padding at a hard history boundary, heal split wide cells, and useScreenBehavior.erase_severs_history_wrapto select the in-place erase behavior. The Ghostty preset retains the link.Terminal erases & VT formatter
src/libvt/terminal.py: apply the wrap policy to erasable incoming continuations andDECALN, keep history epoch tracking, and use\x1b[X(ECH) when replaying synthetic soft-wraps inFormatter._render_vt().src/libvt/testing.py: apply scrubbers within each captured row and use the source frame's profile and cell widths when measuring replacements.Tests & changelog
tests/test_screen.py: cover frozen and held frames,changes_since(), erased viewport reflow, Ghostty behavior, wide boundary protection, and display, line, and alignment operations.tests/test_testing.py: check that scrubbing preserves rows after an erase, clipped wide cells, stored graphemes, and explicit fixed-width padding.CHANGESandMIGRATION: document row-local scrubbers and how to keep temporary paths and fixed-width fields within a captured row.Test plan
uv run ruff format --check .anduv run ruff check .uv run ty check.uv run pytest -qjust -f docs/justfile sphinxopts="-W --keep-going" html