On 2010-04-16 07:59, subtleGradient wrote:
Unfortunately there is no easy way to emulate that in TextMate since ANSi codes are stream based and TextMate is scope based. I'm tempted by the challenge, but I just don't think it's worth the amount of time it would take to make it mostly work.
I was thinking maybe something could be done by treating the escape codes much the same way as you would opening/closing tags in HTML. Unfortunately that wouldn't remove the codes from the display. IMHO that limitation would destroy the usefulness.
On the other hand, it should be fairly simple to reformat the ANSI codes as HTML. Just write a command to convert the document and display it as HTML. That would at least make it pleasing to the eye, without modifying the ANSI sequences in the original file. You couldn't edit in the HTML window, but I get the impression that dzurn isn't looking for something editable. Try the Perl script ansi2html as a starting point.
http://search.cpan.org/~autrijus/HTML-FromANSI-1.01/script/ansi2html http://search.cpan.org/%7Eautrijus/HTML-FromANSI-1.01/script/ansi2html