From d6495a9cfddb65fb9b3cb09771ee0bef88d5d9f7 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 10 Dec 2017 01:19:52 -0400 Subject: Set the ANSI compressor on OVERLOAD (underload?) --- util/Flushable.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'util/Flushable.js') diff --git a/util/Flushable.js b/util/Flushable.js index 2248fec..78bf5c5 100644 --- a/util/Flushable.js +++ b/util/Flushable.js @@ -86,14 +86,21 @@ module.exports = class Flushable { compress(toWrite) { // TODO: customize screen size - let screen = ansi.interpret(toWrite, this.screenLines, this.screenCols) + let { newChars, lastChar, screen } = ansi.interpret( + toWrite, this.screenLines, this.screenCols, + this.lastFrameChars, this.lastFrameLastChar + ) + + this.lastFrameChars = newChars + this.lastFrameLastChar = lastChar if (this.shouldShowCompressionStatistics) { const pcSaved = Math.round(100 - (100 / toWrite.length * screen.length)) screen += ( - '\x1b[1A (ANSI-interpret: ' + - `${toWrite.length} -> ${screen.length} ${pcSaved}% saved)` + '\x1b[H\x1b[0m(ANSI-interpret: ' + + `${toWrite.length} -> ${screen.length} ${pcSaved}% saved) ` ) + this.lastFrameLastChar.attributes = [] } return screen -- cgit 1.3.0-6-gf8a5