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:
@@ -87,6 +87,7 @@ function ANSIEscapeParser(options) {
|
|||||||
let pos = 0;
|
let pos = 0;
|
||||||
let start = 0;
|
let start = 0;
|
||||||
let charCode;
|
let charCode;
|
||||||
|
let lastCharCode;
|
||||||
|
|
||||||
while(pos < len) {
|
while(pos < len) {
|
||||||
charCode = text.charCodeAt(pos) & 0xff; // 8bit clean
|
charCode = text.charCodeAt(pos) & 0xff; // 8bit clean
|
||||||
@@ -102,6 +103,12 @@ function ANSIEscapeParser(options) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LF :
|
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));
|
self.emit('literal', text.slice(start, pos));
|
||||||
start = pos;
|
start = pos;
|
||||||
|
|
||||||
@@ -126,6 +133,7 @@ function ANSIEscapeParser(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
++pos;
|
++pos;
|
||||||
|
lastCharCode = charCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user