fix: leave terminal default foreground for uncolored text#87
Merged
Conversation
commit: |
|
Size Increased — +0.3 KB 107.5 KB unpacked |
Text with no explicit color was packed as concrete white (0xFFFFFFFF), forcing white on light-background terminals. Encode absent color as ATTR_DEFAULT (0x80 in the attrs byte) so the C path skips the foreground SGR entirely, mirroring how an unset background is already left alone. Fixes #62
6994f81 to
d9f71e2
Compare
Just testing text attributes, shouldn't need an enclosing box.
ffe8c33 to
6e38018
Compare
cowboyd
approved these changes
Jun 5, 2026
cowboyd
left a comment
Collaborator
There was a problem hiding this comment.
Looks good! I shortened up the test since it doesn't really need a bounding box in order to test text properties
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.
coloris absent,ops.tsnow writes 0 and setsATTR_DEFAULT(0x80) in the attrs byte; the existing C path ORs it into fg andemit_attrskips the foreground SGR — mirroring how an unset background is already left aloneops.ts); explicitly-colored text is unchangeddeno testgreen (8 passed); reprotest/default-foreground.test.tspasses;deno lint+deno fmt --checkclean