Fixed missing ansi codes causing formatting misses
This commit is contained in:
parent
72a8546d74
commit
450ba65565
|
@ -12,7 +12,6 @@ const _ = require('lodash');
|
|||
|
||||
exports.ANSIEscapeParser = ANSIEscapeParser;
|
||||
|
||||
const TAB = 0x09;
|
||||
const CR = 0x0d;
|
||||
const LF = 0x0a;
|
||||
|
||||
|
@ -25,7 +24,7 @@ function ANSIEscapeParser(options) {
|
|||
this.graphicRendition = {};
|
||||
|
||||
this.parseState = {
|
||||
re: /(?:\x1b)(?:(?:\x5b([?=;0-9]*?)([ABCDEFGfHJKLmMsSTuUYZ]))|([78DEHM]))/g, // eslint-disable-line no-control-regex
|
||||
re: /(?:\x1b)(?:(?:\x5b([?=;0-9]*?)([ABCDEFGfHJKLmMsSTuUYZt@PX]))|([78DEHM]))/g, // eslint-disable-line no-control-regex
|
||||
};
|
||||
|
||||
options = miscUtil.valueWithDefault(options, {
|
||||
|
@ -111,14 +110,6 @@ function ANSIEscapeParser(options) {
|
|||
charCode = text.charCodeAt(pos) & 0xff; // 8bit clean
|
||||
|
||||
switch (charCode) {
|
||||
case TAB:
|
||||
self.emit('literal', text.slice(start, pos + 1));
|
||||
start = pos + 1;
|
||||
|
||||
self.column += 8 - ((self.column - 1) % 8);
|
||||
|
||||
self.positionUpdated();
|
||||
break;
|
||||
case CR:
|
||||
self.emit('literal', text.slice(start, pos + 1));
|
||||
start = pos + 1;
|
||||
|
@ -255,7 +246,7 @@ function ANSIEscapeParser(options) {
|
|||
self.parseState = {
|
||||
// ignore anything past EOF marker, if any
|
||||
buffer: input.split(String.fromCharCode(0x1a), 1)[0],
|
||||
re: /(?:\x1b)(?:(?:\x5b([?=;0-9]*?)([ABCDEFGfHJKLmMsSTuUYZ]))|([78DEHM]))/g, // eslint-disable-line no-control-regex
|
||||
re: /(?:\x1b)(?:(?:\x5b([?=;0-9]*?)([ABCDEFGfHJKLmMsSTuUYZt@PX]))|([78DEHM]))/g, // eslint-disable-line no-control-regex
|
||||
stop: false,
|
||||
};
|
||||
};
|
||||
|
@ -585,6 +576,11 @@ function ANSIEscapeParser(options) {
|
|||
self.column = Math.max( 1, self.column - (self.column % 8 || 8) );
|
||||
self.positionUpdated();
|
||||
break;
|
||||
case '@':
|
||||
// insert column(s)
|
||||
arg = isNaN(args[0]) ? 1 : args[0];
|
||||
self.emit('insert columns', self.row, self.column, arg);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
11
core/art.js
11
core/art.js
|
@ -338,6 +338,17 @@ function display(client, art, options, cb) {
|
|||
});
|
||||
});
|
||||
|
||||
ansiParser.on('insert columns', (row, startCol, numCols) => {
|
||||
_.forEach(mciMap, (mciInfo, mapKey) => {
|
||||
if (mciInfo.position[0] === row && mciInfo.position[1] >= startCol) {
|
||||
mciInfo.position[1] += numCols;
|
||||
if(mciInfo.position[1] > client.term.termWidth) {
|
||||
delete mciMap[mapKey];
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Clear the screen, removing any MCI's
|
||||
ansiParser.on('clear screen', () => {
|
||||
_.forEach(mciMap, (mciInfo, mapKey) => {
|
||||
|
|
Loading…
Reference in New Issue