powerman/vim-plugin-AnsiEsc

^[[31m displayed

Closed this issue · 6 comments

Please add ''^[[31m'' as well.

Thank you!

It's already supported, both in last release (13.2) and current master. Can you please provide more details why do you think it doesn't work?

You're right, it gets correctly displayed in VIM.
But if I run TOHtml, save the file, and display it in a browser, I can see the ^[[31m escape sequence.

Again, it works for me. Using this source:

test^[[31mtest^[[0mtest

I got this output, which looks correct:

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/test.txt.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v2">
<meta name="syntax" content="none">
<meta name="settings" content="use_css,no_foldcolumn,prevent_copy=">
<meta name="colorscheme" content="powerman">
<style type="text/css">
<!--
pre { font-family: monospace; color: #c0c0c0; background-color: #0000c0; }
body { font-family: monospace; color: #c0c0c0; background-color: #0000c0; }
* { font-size: 1em; }
.ansiRedFg { color: #c00000; }
-->
</style>

<script type='text/javascript'>
<!--

-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
test<span class="ansiRedFg">test</span>test
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->

With that I can reproduce:

^[[36m@@ -10,122 +10,147 @@^[[m ^[[mv1.0

three ^[[31m modes^[[m^[[32m nodes^[[m - from

Turning on AnsiEsc and then using TOHtml gives me

</head>
<body>
<pre id='vimCodeElement'>
<span class="ansiCyanFg">@@ -10,122 +10,147 @@</span> v1.0

three ^[[31m<span class="ansiRedFg"> modes</span><span class="ansiGreenFg"> nodes</span> - from
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->

Well, looks like this happens when ^[[m is before ^[[31m (or another color code). At same time this issue doesn't happens with ^[[0m instead of ^[[m. Minimal example is:

^[[m one ^[[31m two ^[[m

It turns out they use different highlighting codes: ansiStop for ^[[0m and ansiConceal for ^[[m. I suppose this somehow affect :TOhtml output. I'll check this, thanks for the report.

I've just released new version and uploaded to vim.org, if you prefer to use .zip/.vmb instead of git version.