node-progress icon indicating copy to clipboard operation
node-progress copied to clipboard

ANSI colors not supported in the format

Open Skywalker13 opened this issue 10 years ago • 1 comments

Hello, the width is not computed correctly when ansi colors are used

https://github.com/tj/node-progress/blob/master/lib/node-progress.js#L139

ansi-regex should be considered, something like that

var ansiRegex = require('ansi-regex');

var availableSpace = Math.max(0, this.stream.columns - str.replace(ansiRegex(), '').replace(':bar', '').length);

Skywalker13 avatar Jul 07 '15 11:07 Skywalker13

Happy to review a PR!

thebigredgeek avatar May 20 '16 22:05 thebigredgeek