Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jul 30, 2022

ttyconf.setColor(stderr, .Dim) just like stderr.print("{s}", .{plain.msg}) can fail, so I don't see why we wouldn't handle the former just like the latter. It's an edge case. You can always still ignore the error in your specific case if you want to.
Apart from that it solves a bunch of related TODOs and it also removes a bunch of unreachables in std.Progress which is supposed to be non-fallible because now I'm confident these unreachables can be reached since the user can modify the std.Progress.terminal field. It can probably fail anyway. Better safe than sorry.

@andrewrk
Copy link
Member

Looks like I merged your PRs out of order. Sorry about that. You mind rebasing this one?

@ghost
Copy link
Author

ghost commented Oct 16, 2022

Sure! Rebased.

@ghost
Copy link
Author

ghost commented Oct 28, 2022

Now it should be up-to-date again.

r00ster91 added 3 commits December 13, 2022 09:11
Originally I just wanted to move these down because they seemed to be in some random position of the file,
but these constants look very old with their CASING and pretty unnecessary anyway so I just inlined them.
@ghost
Copy link
Author

ghost commented Dec 13, 2022

aarch64-windows got stuck so I rebased once more. All other CIs already passed though.

@Vexu Vexu enabled auto-merge December 13, 2022 11:51
@Vexu Vexu merged commit 65270cd into ziglang:master Dec 13, 2022
squeek502 added a commit to squeek502/zig that referenced this pull request Dec 15, 2022
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 pushed a commit that referenced this pull request 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)
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