fix(ui): decide colour per output stream - #784
Merged
Merged
Conversation
This was referenced Jul 26, 2026
Commands that print their colourised rows to stdout were deciding whether to colour by probing stderr, so redirecting stdout to a file from a terminal wrote raw escape sequences into the file. Each now asks about the stream it actually writes to. Colour already resolved to a policy, and always/never are stream- independent, so only the auto case gained a per-stream probe.
isColorEnabled() read like the general question but answered only for stderr, so a new stdout writer calling it by habit reintroduced the bug this branch just fixed. Renaming it to isColorEnabledForStderr leaves no default to get wrong; every caller now names the stream it writes to. Mechanical rename, no behaviour change.
indaco
force-pushed
the
fix/stream-aware-color-enablement
branch
from
July 26, 2026 20:59
f09f49d to
a40d27b
Compare
indaco
added a commit
that referenced
this pull request
Jul 27, 2026
* fix(ui): decide colour per output stream Commands that print their colourised rows to stdout were deciding whether to colour by probing stderr, so redirecting stdout to a file from a terminal wrote raw escape sequences into the file. Each now asks about the stream it actually writes to. Colour already resolved to a policy, and always/never are stream- independent, so only the auto case gained a per-stream probe. * refactor(ui): name the stderr colour helper for its stream isColorEnabled() read like the general question but answered only for stderr, so a new stdout writer calling it by habit reintroduced the bug this branch just fixed. Renaming it to isColorEnabledForStderr leaves no default to get wrong; every caller now names the stream it writes to. Mechanical rename, no behaviour change. (cherry picked from commit 7b56595)
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.
Description
Seven commands -
info,which,uses,search,list,outdated,rollback --list- print colourised rows to stdout but decided whether to colour by looking at stderr. Run any of them from a terminal with stdout redirected and raw escape sequences landed in the file. Each now asks about the stream it writes to.Colour already resolved to a policy in the previous change, and
always/neverare stream-independent, so only the auto case gained a per-stream probe. Callers that write to stderr keep the answer they had.Related Issue
Notes for Reviewers
This is part 2 of 3 in a stack made with GitButler: