chalk / slice-ansi

Slice a string with ANSI escape codes
MIT License
47 stars 21 forks source link

Accept true color escape sequences #18

Closed piranna closed 5 years ago

piranna commented 6 years ago

The slice only pick 4 bytes, not enough for longer escape sequences. This change increase it to 18, allowing to accept escape sequences for true color definitions. I have not used an unbounded limit to don't check the regular expression against probably very long strings.

Fix #17

sindresorhus commented 6 years ago

Can you add a test?

sindresorhus commented 5 years ago

Ping :)

viddo commented 5 years ago

Just ran into the same problem, and found this PR while troubleshooting the code. I can confirm this fix working by modifying the installed source in node_modules. 👍

@sindresorhus while a test is missing for the code change, it seems like the last CI test failure was due to some xo offenders unrelated to this PR?

piranna commented 5 years ago

I have just merged the test provided by @viddo.

piranna commented 5 years ago

Thank you :-)