ansilove.js

A script to display ANSi and artscene related file formats on web pages
Log | Files | Refs | README | LICENSE

commit 67bbb915de30525cfe25027e5b3dcad5e20b4af7
parent d4779358d61b24e6af3cbd852161855498479934
Author: Andy Herbert <andy.herbert@gmail.com>
Date:   Sat, 12 Oct 2013 13:13:30 +0100

Fixed a problem with the ANSI rendering, whereby the literal escape character wasn't shown if it was not part of an escape-sequence.

Diffstat:
Mansilove.js | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/ansilove.js b/ansilove.js @@ -930,21 +930,22 @@ var AnsiLove = (function () { case 13: case 26: break; - case 27: - escaped = true; - break; default: - if (mode === "ced") { - imageData.set(x - 1, y - 1 + topOfScreen, code, 1); + if (code === 27 && file.peek() === 0x5B) { + escaped = true; } else { - if (!inverse) { - imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (foreground + 8) : foreground) + (blink && icecolors ? (background + 8 << 4) : (background << 4))); + if (mode === "ced") { + imageData.set(x - 1, y - 1 + topOfScreen, code, 1); } else { - imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (background + 8) : background) + (blink && icecolors ? (foreground + 8 << 4) : (foreground << 4))); + if (!inverse) { + imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (foreground + 8) : foreground) + (blink && icecolors ? (background + 8 << 4) : (background << 4))); + } else { + imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (background + 8) : background) + (blink && icecolors ? (foreground + 8 << 4) : (foreground << 4))); + } + } + if (++x === columns + 1) { + newLine(); } - } - if (++x === columns + 1) { - newLine(); } } }