Sixel output disappears after using color command #22900

Closed
opened 2026-01-31 08:26:38 +00:00 by claunia · 4 comments
Owner

Originally created by @DarkXrs on GitHub (Feb 10, 2025).

Windows Terminal version

1.22.10352.0

Windows build number

10.0.19045.5371

Other Software

No response

Steps to reproduce

  1. Open terminal on command prompt, download attached file (this happens on any sixel file), and type

s.txt

TYPE s.txt
  1. Image shows. Then use the color command (does not have to be a different color). For example
color 0f

Expected Behavior

Sixel image stays

Actual Behavior

Sixel image disappears

Originally created by @DarkXrs on GitHub (Feb 10, 2025). ### Windows Terminal version 1.22.10352.0 ### Windows build number 10.0.19045.5371 ### Other Software _No response_ ### Steps to reproduce 1. Open terminal on command prompt, download attached file (this happens on any sixel file), and type [s.txt](https://github.com/user-attachments/files/18741083/s.txt) ``` TYPE s.txt ``` 2. Image shows. Then use the color command (does not have to be a different color). For example ``` color 0f ``` ### Expected Behavior Sixel image stays ### Actual Behavior Sixel image disappears
claunia added the Resolution-By-DesignNeeds-TriageIssue-Bug labels 2026-01-31 08:26:38 +00:00
Author
Owner

@j4james commented on GitHub (Feb 11, 2025):

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:

f28f65870a/src/host/_output.cpp (L242-L243)

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.

@j4james commented on GitHub (Feb 11, 2025): Thanks for raising this issue. The reason this occurs is because the `color` command uses the console [`FillConsoleOutputAttribute`](https://learn.microsoft.com/en-us/windows/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`](https://vt100.net/docs/vt510-rm/DECCARA.html) 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: https://github.com/microsoft/terminal/blob/f28f65870a9caeb629498c83efc4ab6992c93bad/src/host/_output.cpp#L242-L243 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.
Author
Owner

@DarkXrs commented on GitHub (Feb 12, 2025):

Ah, that makes sense, thanks for your reply! Just curious, what do you mean by "in conhost the color command currently doesn't erase the image"? Is there a way to use Sixels in conhost?

@DarkXrs commented on GitHub (Feb 12, 2025): Ah, that makes sense, thanks for your reply! Just curious, what do you mean by "in conhost the color command currently doesn't erase the image"? Is there a way to use Sixels in conhost?
Author
Owner

@j4james commented on GitHub (Feb 12, 2025):

@DarkXrs When I say conhost, I really mean the OpenConsole version of the terminal that will eventually be distributed as conhost in a future Windows update. It's technically had Sixel support for a while now, but it'll probably be a long time before that functionality is available to regular Windows users. But if you want to try it out, I think you can just extract the OpenConsole.exe from one of the Windows Terminal zips on the releases page.

@j4james commented on GitHub (Feb 12, 2025): @DarkXrs When I say conhost, I really mean the OpenConsole version of the terminal that will eventually be distributed as conhost in a future Windows update. It's technically had Sixel support for a while now, but it'll probably be a long time before that functionality is available to regular Windows users. But if you want to try it out, I think you can just extract the `OpenConsole.exe` from one of the Windows Terminal zips on the [releases](https://github.com/microsoft/terminal/releases) page.
Author
Owner

@carlos-zamora commented on GitHub (Feb 12, 2025):

Thanks for filing! Yeah, as j4james mentioned above, this is by design, so I'm going to close this bug.

That said, I'm opening another one for the one j4james found above.

@carlos-zamora commented on GitHub (Feb 12, 2025): Thanks for filing! Yeah, as j4james mentioned [above](https://github.com/microsoft/terminal/issues/18556#issuecomment-2651331837), this is by design, so I'm going to close this bug. That said, I'm opening another one for the one j4james found above.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22900