node-progress
node-progress copied to clipboard
Fix bar width when using ANSI styling
This fixes the issue when using colors that the progress bar will usually be collapsed. It strips the ANSI styling when calculating the available space and works with the raw data being displayed.
The regex was taken from: https://github.com/chalk/ansi-regex/blob/master/index.js#L3 and seems to work well.
Why this isn't pushed to npm ?
I had to fiddle with source code to find out why the output is shorter when using cli-colors. Thanks to this fix i was able to get it working quite easily although editing the source code manually is not a good idea.