chalk/wrap-ansi

Off by one if trimming is disabled #25

watson posted onGitHub

If trimming is disabled, and you're wrapping a text a say length 3, and there's a whitespace right where the wrap should occur, the whitespace remains and the line break is appended to it. This results in the line being one char too long:

console.log(JSON.stringify(trim('foo bar', 3)))                // => "foo\nbar"
console.log(JSON.stringify(trim('foo bar', 3, {trim: false}))) // => "foo \nbar"

Fund this Issue

$40.00
Rewarded

Rewarded pull request

Recent activities

stroncium was rewarded by sindresorhus for chalk/wrap-ansi# 25
about 6 years ago
stroncium submitted an output to  chalk/ wrap-ansi# 25
about 6 years ago