rburns / ansi-to-html

Convert ansi escaped text streams to html.
MIT License
357 stars 48 forks source link

Support clearing via ESC[2J #14

Closed dowdell closed 5 years ago

dowdell commented 9 years ago

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.

jaredly commented 9 years ago

One way to do this is

myOutput.replace(/^.*\x1b\[[12]J/g, '')
rburns commented 9 years ago

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.

dowdell commented 9 years ago

:clap:

TakenPilot commented 7 years ago

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?

rburns commented 7 years ago

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.

earthman1 commented 5 years ago

Please see the new comments on #25 which will show that this issue is probably not related.

laurensV commented 1 year ago

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