Drop a line's shell integration marks when ED erases it whole - #155
Merged
Conversation
`clear` is CSI 3 J, CUP, CSI 2 J: the scrollback discarded, the screen blanked in place. ED 3 takes the lines and their marks with it, but ED 2 blanked the screen rows and left their OSC 133 marks behind, so a host drawing a gutter from them kept painting prompt and exit bars beside empty rows. A row ED erases in full now loses its marks along with its double-size attribute, through the same nothing-survived decision. EL keeps them, as before: shells redraw a prompt they have just marked with EL. The cursor row of ED 0 and ED 1 goes through EL, so a shell that homes the cursor and erases below before printing its prompt keeps that mark. Selective erases leave marks standing with the text they protect. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The behavior is covered by regression tests, with only a non-blocking documentation nit remaining.
Pull request overview
Updates full-row display erases to remove stale shell-integration marks while preserving marks for EL and selective erases.
Changes:
- Clears marks when a row is fully erased.
- Adds regression coverage for screen-erasure variants.
- Non-blocking nit: broaden affected XML summaries beyond ED-only behavior.
File summaries
| File | Description |
|---|---|
src/XTerm.NET/InputHandler.Protection.cs |
Clears marks alongside full-row attributes. |
src/XTerm.NET.Tests/ShellIntegrationMarkAnchorTests.cs |
Tests mark retention and removal rules. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot's review: ClearMarks claimed only line reuse called it, and the helper described itself as ED-only when EraseWholeScreen -- DECCOLM's clear, DECRST 1047 blanking the alternate screen -- reaches it too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What
clearisCSI 3 J,CUP,CSI 2 J: the scrollback discarded, the screen blanked in place. ED 3 takes the lines and their marks with it, but ED 2 blanked the screen rows and left their OSC 133 marks behind — so a host drawing a gutter from them kept painting prompt and exit bars beside empty rows. Seen with pwsh'sClear-Hostin the Iciclecreek demo's gutter.Fix
A row ED erases in full now loses its marks along with its double-size attribute, through the same nothing-survived decision already in
EraseLineCells. The rules:Kitty and Ghostty both drop a row's prompt flag when ED clears it, so this matches the terminals hosts will be compared against.
Tests
Three added to
ShellIntegrationMarkAnchorTests: theclearsequence drops every row's marks; erase-below keeps the cursor row's mark and drops the rest; a selective screen erase leaves marks alone. Full suite: 2217 passed, 1 skipped.🤖 Generated with Claude Code