Skip to content

render: defer conversion of TextColor into COLORREF until actual rendering time (avoid ConPTY narrowing bugs) #2661

@DHowett-MSFT

Description

@DHowett-MSFT

Right now, every time Renderer needs to switch the brush colors, it does the following:

  1. get the TextColor from the attribute run
  2. get the RGB value of the color from the color table
  3. pass that to Engine::UpdateDrawingBrushes

Step 2 is lossy, and is the source of a class of bugs I'll call "ConPTY narrowing" bugs. In addition, there's a step where VtEngine needs to know the color table to do a translation from RGB back into indexed color.

"narrowing" bugs

application output conpty sends why
\e[38;2;22;198;12m \e[92m RGB(22, 198, 12) matches color index 10 in Campbell
\e[38;5;127m \e[38;2;175;0;175m the xterm-256color color palette gets translated into RGB because Campbell only covers 0-16
\e[38;2;12;12;12m \e[30m RGB(12, 12, 12) matches index 0 in Campbell and index 0 is the default color (#293)

If Renderer passed the TextColor directly to the Engine, Xterm256Engine could pass through all indexed colors unchanged, and XtermEngine and WinTelnetEngine could flatten to the 16-color space.

Metadata

Metadata

Assignees

Labels

Area-RenderingText rendering, emoji, complex glyph & font-fallback issuesIssue-TaskIt's a feature request, but it doesn't really need a major design.Priority-1A description (P1)Product-ConhostFor issues in the Console codebaseProduct-ConptyFor console issues specifically related to conptyProduct-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions