Skip to content

Conversation

@squeek502
Copy link
Member

@squeek502 squeek502 commented Dec 15, 2022

This fixes a regression introduced in #12298 where colors would never reset in a Windows console because the attributes would be queried on every setColor call, and then try to 'reset' the attributes to what it just queried (i.e. it was essentially doing a complicated no-op on .Reset).

This fixes the problem while (I think) keeping with the spirit of the changes in #12298--that is, TTY.Config is not specifically tied to stderr like it was before #12298. To that end, detectTTYConfig now takes a File and that's what gets used to query the initial attributes to reset to.

(for context, before #12298, the first setColor call is where the reset attributes would get queried and it would always use stderr to do it)

Before (the green of the ^ would carry over to the output of zig version):

color-reset-before

After:

color-reset-after

cc @r00ster91

This fixes a regression introduced in ziglang#12298 where colors would never reset in a Windows console because the attributes would be queried on every `setColor` call, and then try to 'reset' the attributes to what it just queried (i.e. it was essentially doing a complicated no-op on .Reset).

This fixes the problem while (I think) keeping with the spirit of the changes in ziglang#12298--that is, `TTY.Config` is not specifically tied to stderr like it was before ziglang#12298. To that end, detectTTYConfig now takes a `File` and that's what gets used to query the initial attributes to reset to.

(for context, before ziglang#12298, the first `setColor` call is where the reset attributes would get queried and it would always use stderr to do it)
@andrewrk andrewrk enabled auto-merge (rebase) December 15, 2022 04:10
@andrewrk andrewrk merged commit 88d927a into ziglang:master Dec 15, 2022
@ghost
Copy link

ghost commented Dec 15, 2022

Whoops, sorry about that!

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.

2 participants