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

fix(fmt): make printf working with colors. #6360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keelii
Copy link

@keelii keelii commented Jan 24, 2025

printf is not working well with colors package.

➜  ent-std git:(master) ✗ cat test.ts  
import { printf } from "jsr:@std/fmt/printf";
import {underline} from "jsr:@std/fmt/colors";

printf("a: %7s|\n", underline("foo"))
printf("b: %7s|\n", underline("foo bar"))
➜  ent-std git:(master) ✗ deno run -A test.ts
a: foo|
b: foo bar|

Add stripAnsiCode in Printf.fmtString maybe solve this problem.

➜  std git:(feat/make_printf_working_with_colors) ✗ cat test.ts  
import {printf} from "./fmt/printf.ts";
import {underline} from "./fmt/colors.ts";

printf("a: %7s|\n", underline("foo"))
printf("b: %7s|\n", underline("foo bar"))
➜  std git:(feat/make_printf_working_with_colors) ✗ deno run -A test.ts
a:     foo|
b: foo bar|

@keelii keelii requested a review from kt3k as a code owner January 24, 2025 07:09
@github-actions github-actions bot added the fmt label Jan 24, 2025
@CLAassistant
Copy link

CLAassistant commented Jan 24, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.35%. Comparing base (6c96a0c) to head (3f162c7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6360   +/-   ##
=======================================
  Coverage   96.34%   96.35%           
=======================================
  Files         552      552           
  Lines       41939    41944    +5     
  Branches     6357     6358    +1     
=======================================
+ Hits        40408    40415    +7     
+ Misses       1491     1489    -2     
  Partials       40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kt3k kt3k changed the title feat(fmt): make printf working with colors. fix(fmt): make printf working with colors. Jan 24, 2025
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants