Repository navigation
Conversation
RectangleRenderer forced the alpha of every cell background rectangle to 1. Cells with the italic, dim, underline or overline attribute carry flags in their bg value, so they get a rectangle even when they use the default background. With allowTransparency and a transparent theme background that rectangle was painted opaque, leaving a black box behind the text. Only add a rectangle when the background color mode is not default or the cell is inverse, and take the alpha from the resolved color, setting it to 0xFF for 24-bit colors, which are packed without an alpha byte. Opaque themes render the same as before.
|
I checked this PR (c99849e) against master (08829c7) with a few more styles than the tests cover. Headless Chrome with SwiftShader, magenta page, ten styled spaces per row sampled at the cell centre. The terminal starts with an opaque
With the translucent theme set from the start, plain, dim, italic, curly underline and bold read the same. |
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.
Fixes #6116
With
allowTransparencyand a transparent theme background, the WebGL renderer painted an opaque rectangle behind italic and dim cells (and underlined and overlined ones). Those cells keep their attribute flags inbg, soupdateBackgrounds()gives them a rectangle with the default background color, and_updateRectangle()then forced its alpha to 1.This follows @azekyoo's analysis in the issue and does both things suggested there:
updateBackgrounds()only adds a rectangle when the background color mode is not default (or the cell is inverse), so attribute flags alone no longer produce one._updateRectangle()takes the alpha from the resolved color instead of forcing 1. The two 24-bit branches are packed without an alpha byte, so they now OR in0xFF, the same wayCellColorResolverdoes.Opaque themes are unaffected: every color there has alpha
0xFF. In Chromium the demo after "SGR test" is pixel-identical before and after this change with the demo theme, also with 24-bit and inverse 24-bit backgrounds.Tests:
allowTransparencyinSharedRendererTests.ts: with a fully transparent background, italic and dim cells show the page; with a semi-transparent one (#2850a080), they have the same pixels as a plain cell. Both fail on WebGL without the change and pass on the DOM and WebGL renderers with it. They repaint the viewport before each check, so pixels left by an earlier test cannot show through.addon-webglandRenderer.test.tsPlaywright suites pass in Chromium; unit tests and lint pass.Before and after in the demo (WebGL,
allowTransparencyticked, "SGR test"), zoomed 4x:Before:
After:
The video shows the demo with
allowTransparencyon and the SGR test output, before and after: the italic and dim rows lose their black boxes and sit on the checkerboard.xterm.mp4
The demo's checkerboard is lightened in the recorded fork (not part of this PR) so the black boxes are easier to see.
Fix written with Claude Code; video is an automated browser run of this branch recorded by User Stories Bot.