Skip to content

Conversation

@Tyriar
Copy link
Member

@Tyriar Tyriar commented Oct 9, 2018

Fixes #1737


This issue was happening as we were assuming fg was a number >= 0 for the glyph key but it could also be -1 to indicate an inverse default color. See the first commit for this fix.

The second commit cleans up the usage of 256/257 as the fg color by introducing constants. It also removes 257 as the "No BG color key" and instead uses 256 as that is the default color for the background, I don't think there's a reason to differentiate them.

The third commit fixes #1738 (not a regression).


Before

DOM Renderer

screen shot 2018-10-09 at 11 41 42 am

Canvas/static

screen shot 2018-10-09 at 11 41 05 am

Canvas/dynamic

screen shot 2018-10-09 at 11 41 34 am

After

DOM Renderer

screen shot 2018-10-09 at 11 42 47 am

Canvas/static

screen shot 2018-10-09 at 11 42 30 am

Canvas/dynamic

screen shot 2018-10-09 at 11 42 38 am

@Tyriar Tyriar added this to the 3.9.0 milestone Oct 9, 2018
@Tyriar Tyriar self-assigned this Oct 9, 2018
@Tyriar Tyriar requested a review from bgw October 9, 2018 18:39
@Tyriar Tyriar requested a review from jerch November 23, 2018 14:56
if (fg === INVERTED_DEFAULT_COLOR) {
this._ctx.fillStyle = this._colors.background.css;
} else if (fg < 256) {
} else if (fg < DEFAULT_COLOR) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a range check against what is essentially an enum value is a little confusing. Since we're doing this in a few places, maybe we should have a isNormalColor helper function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 😃

Copy link
Member

@jerch jerch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comments form myside, LGTM.

@Tyriar Tyriar merged commit 1db1770 into xtermjs:master Nov 24, 2018
@Tyriar Tyriar deleted the 1737_inverse_dynamic_cache branch November 24, 2018 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inverted default fg color is not correct in DOM renderer Inverse characters are not printed correctly when used with dynamic texture atlas

3 participants