Closed dowdell closed 5 years ago
One way to do this is
myOutput.replace(/^.*\x1b\[[12]J/g, '')
I think those escape codes which do some manner of rewriting in place, like this one, and #12 are probably best ignored. Supporting them would probably require fairly significant re-working of things. Unless someone has an alternative approach, I'll implement that soon.
:clap:
What would be the interface for something like this?
This library only produces static lines, so unless the request has some idea of how to indicate that the "terminal" should be cleared, our only choice is to just ignore these characters.
I guess this issue can be closed?
yes, I think this issue could be closed, as well as https://github.com/rburns/ansi-to-html/issues/16 I don't see any reasonable way to address this. It may be worthwhile to ensure that codes we can't act on are elided.
This issue may also be roughly the same thing https://github.com/rburns/ansi-to-html/issues/25 though, it's been long enough, I don't remember the details right now.
Please see the new comments on #25 which will show that this issue is probably not related.
We should probably have the option to have those lines removed entirely from the html if they would also have been cleared in the terminal
Not sure if this is the right place for this issue, but is similar to #12, though I can't think of a good workaround in case this is also tricky to support.
Some of my build tools display progress bars or spinners (
\
to|
to/
), and attempt to clear the "terminal" before redrawing, but instead generate a lot of redundant output when run through something like atom-build.