ANSI FILE_ID.DIZ sometimes do not display correctly #244

* When parsing ANSI files, handle UNIX style LF's only vs "standard" DOS CRLF pairs
This commit is contained in:
Bryan Ashby 2020-05-16 17:37:51 -06:00
parent f23027ba1d
commit 02fa3b014b
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
1 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,7 @@ function ANSIEscapeParser(options) {
let pos = 0;
let start = 0;
let charCode;
let lastCharCode;
while(pos < len) {
charCode = text.charCodeAt(pos) & 0xff; // 8bit clean
@ -102,6 +103,12 @@ function ANSIEscapeParser(options) {
break;
case LF :
// Handle ANSI saved with UNIX-style LF's only
// vs the CRLF pairs
if (lastCharCode !== CR) {
self.column = 1;
}
self.emit('literal', text.slice(start, pos));
start = pos;
@ -126,6 +133,7 @@ function ANSIEscapeParser(options) {
}
++pos;
lastCharCode = charCode;
}
//