Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EraseCells should work on multiple rows #18568

Open
carlos-zamora opened this issue Feb 12, 2025 · 0 comments
Open

EraseCells should work on multiple rows #18568

carlos-zamora opened this issue Feb 12, 2025 · 0 comments
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase
Milestone

Comments

@carlos-zamora
Copy link
Member

Thanks for raising this issue. The reason this occurs is because the color command uses the console FillConsoleOutputAttribute API to update the colors, and these legacy console APIs aren't intended to be mixed with VT operations like Sixel, so this is essentially undefined behavior.

In the current implementation the fill is treated as a destructive operation. When translated to VT it rewrites all the text using the new colors, and that erases any images that are overwritten. I think we did discuss the possibility of translating this API into a VT DECCARA sequence, which would be non-destructive, so it's possible this could be fixed (at least on some terminals).

Either way, there is definitely a bug evident here, because in conhost the color command currently doesn't erase the image, and that wasn't actually the intended behavior. I think the problem is in the call here:

// If we've overwritten image content, it needs to be erased.
ImageSlice::EraseCells(screenInfo.GetTextBuffer(), startingCoordinate, result.cellsModified);

That EraseCells method is only capable of erasing a single row, but the APIs being dealt with here are designed to fill a range that could wrap over multiple rows. In the case of the color command, it's a single fill call that covers the entire buffer. So if you had a Sixel image at the very top of the buffer, you'd see just the first row of the image erased, but in most cases nothing would be erased.

Originally posted by @j4james in #18556

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 12, 2025
@carlos-zamora carlos-zamora removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Feb 12, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Tag-Fix Doesn't match tag requirements labels Feb 12, 2025
@carlos-zamora carlos-zamora removed the Needs-Tag-Fix Doesn't match tag requirements label Feb 12, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Feb 12, 2025
@carlos-zamora carlos-zamora added Product-Conhost For issues in the Console codebase Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Tag-Fix Doesn't match tag requirements labels Feb 12, 2025
@carlos-zamora carlos-zamora added this to the Backlog milestone Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase
Projects
None yet
Development

No branches or pull requests

1 participant