chalk/wrap-ansi

Incorrect leading spaces

Closed this issue · 6 comments

Issuehunt badges

with version 2.3.0:

// 1 leading space
require('wrap-ansi')(' a ', process.stdout.columns, {trim: false})

Out:

// 2 leading spaces
'  a '

stroncium earned $80.00 by resolving this issue!

kevva commented

I think we need to make sure that we aren't in the beginning of a line with a '' character here https://github.com/chalk/wrap-ansi/blob/master/index.js#L94-L103.

bcoe commented

@egoist this definitely seems wrong to me too. Could I convince you to add a failing test? Would also happily help you land a fix, if you decide you're interested in taking on this issue.

@IssueHunt has funded $80.00 to this issue. See it on IssueHunt

@egoist Try removing both the white spaces before and after 'a'.

@sindresorhus has rewarded $72.00 to @stroncium. See it on IssueHunt

  • 💰 Total deposit: $80.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $8.00