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

Allow inverse colors to be stored in glyph keys, fix inverted colors in DOM renderer #1739

Merged
merged 8 commits into from
Nov 24, 2018

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
@@ -298,7 +298,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {

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
3 participants