diff --git a/core/art.js b/core/art.js index f6c0c4d9..114800ee 100644 --- a/core/art.js +++ b/core/art.js @@ -322,6 +322,29 @@ function display(client, art, options, cb) { }); }); + ansiParser.on('insert line', (row, numLines) => { + _.forEach(mciMap, (mciInfo) => { + if (mciInfo.position[0] >= row) { + mciInfo.position[0] += numLines; + } + }); + }); + + ansiParser.on('delete line', (row, numLines) => { + _.forEach(mciMap, (mciInfo, mapKey) => { + if (mciInfo.position[0] >= row) { + if(mciInfo.position[0] < row + numLines) { + // unlike scrolling, the rows are actually gone, + // so we need to delete any MCI's that are in them + delete mciMap[mapKey]; + } + else { + mciInfo.position[0] -= numLines; + } + } + }); + }); + ansiParser.on('literal', literal => client.term.write(literal, false)); ansiParser.on('control', control => client.term.rawWrite(control));