Closed gandalf3 closed 1 year ago
@uttarayan21 thanks for the repo, care to merge this PR? Thanks!
Sorry about that. I totally forgot about this pr.
I'll make a small change and merge this.
Edit: I'm being dumb.
But I did make a commit that keeps changing the style even if the span content is empty.
Thank you for the pr
This change attempts to parse most common escape codes the way a terminal would, but it is not exhaustive. At the very least it guarantees the escape character will be consumed which should prevent an infinite loop even if some unexpected garbage could end up in the output text.
Fixes: https://github.com/uttarayan21/ansi-to-tui/issues/20
I chose to eat unsupported escape codes as I believe this to be the behavior most likely expected by consumers of this library, and there are potential security ramifications of emitting control characters where developers may not be expect them.
However, I do think there is an argument to be made for allowing unsupported escape sequences through for a downstream client to handle. This implementation should facilitate implementing that as an option at a later date.