Skip to content

screen(fix[erase]): Sever wraps once per span - #209

Merged
tony merged 1 commit into
masterfrom
fix/199-erase-wrap-perf
Dec 5, 2026
Merged

tony merged 1 commit into
masterfrom
fix/199-erase-wrap-perf

Conversation

@tony

@tony tony commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #199

Summary

  • Adds Screen._clear_rows(start, stop, bce_word, bce_ext, *, selective=False, sever_boundary=True) in src/libvt/screen.py with a unified sever_boundary contract across both non-selective (reset_blank) and selective (DECSED) spans, severing incoming wraps once at the surviving predecessor boundary rather than per cleared row.
  • Routes ED 0, ED 1, ED 2, ED 22 (alt), and DECCOLM full-row clears through _clear_rows, guards ED 0 / EL 0 incoming-wrap checks to c_col <= 1, and aligns DECCOLM clears to sever incoming scrollback wraps (honoring Profile.screen.erase_severs_history_wrap).
  • Reduces #199 _sever_incoming_wrap calls from 10,000 to 400 (-96%) and improves redraw-heavy throughput by +17% to +42% with no regressions on partial erases or plain printing.
  • Adds full boundary, DECCOLM, wide-cell, DECSED, BCE (ED 0/1/2), cols=1, ?2026 held/committed, and CoW isolation tests in tests/test_screen.py.

Verification

  • Clean-room parity verified against ECMA-48 (ED/EL), DEC STD 070 (DECSED/DECSEL/DECCOLM), 4 permissive lineages (tmux, ghostty, alacritty, wezterm), whole/bytewise replay, and live tmux 3.4 private-socket parity.
  • Ruff, ty (3.12–3.15 + win32 3.12), pytest (1258 passed, 2 skipped), Sphinx dirhtml -W (0 warnings).
  • Independent staff review verdict: adopt as is (Gates 1–4 PASS, 5/5 mutants killed, new code 9.6/10, all applicable items 9.5–9.8/10).

why: Full-row display erases checked _sever_incoming_wrap on every
cleared row even when the predecessor row had already been cleared in
the same non-selective span, and DECCOLM clears skipped severing
incoming scrollback wraps.

what:
- Add Screen._clear_rows with a consistent sever_boundary contract
  across non-selective and selective erases
- Route ED 0/1/2/22 and DECCOLM full-row clears through _clear_rows and
  guard EL 0 / ED 0 incoming-wrap checks to c_col <= 1
- Add regression tests for bounded wrap checks, wrap/history boundaries,
  narrow-to-wide splits, DECCOLM, BCE, cols=1, DECSED, and ?2026 CoW
- Record the fix in CHANGES under 0.0.1a7 Fixes

Fixes #199
@tony
tony merged commit 8ea63b6 into master Dec 5, 2026
9 checks passed
@tony
tony deleted the fix/199-erase-wrap-perf branch December 5, 2026 17:03
@tony tony mentioned this pull request Dec 5, 2026
35 of 38 tasks

This branch was successfully deployed

1 active deployment
docs — 43469f47 Deployed Dec 5, 2026 by tony via build (3.14) #507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full-display erases repeatedly visit cleared predecessor rows

1 participant