trim function flaw
StreetStrider opened this issue · 1 comments
StreetStrider commented
Good day!
It seemes that additional trim function does not handles fine xterm-sequences:
clc = require('cli-color');
trim = require('cli-color/lib/trim');
A = clc.red('AAA');
> '\u001b[31mAAA\u001b[39m'
trim(A)
> 'AAA'
B = clc.xterm(218)('BBB');
> '\u001b[38;5;218mBBB\u001b[39m'
trim(B)
> '\u001b[38;5;218mBBB'
Maybe trim regexp is not enough powerful for this.
BTW, thanks for that lib, it's really easy-to-use and awesome!
medikoo commented
@StreetStrider indeed, I wrote it for one of the first versions and then took only basic color sequences into account.
I've just fixed it and published as v0.2.2, it should trim all types of control sequences now.
Thanks!