From 6db88b6d26bb272c4de03430fb03e140747f27a2 Mon Sep 17 00:00:00 2001 From: nuintun Date: Wed, 2 Dec 2015 12:42:30 +0800 Subject: [PATCH] update files --- static/js/terminal/index.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/static/js/terminal/index.js b/static/js/terminal/index.js index eeaf2ed..c0338b5 100644 --- a/static/js/terminal/index.js +++ b/static/js/terminal/index.js @@ -1031,7 +1031,7 @@ AnsiTerminal.prototype.toString = function (type){ if (type === 'html') { var styleBuffer; - var attrCache = null; + var attrCache; var stylesBuffer = this.stylesBuffer || []; stylesBuffer = stylesBuffer.slice(0, rows); @@ -1045,7 +1045,6 @@ AnsiTerminal.prototype.toString = function (type){ for (j = 0; j < cols; ++j) { node = this.screen.buffer[i].cells[j]; styleBuffer = stylesBuffer[i][j] || styles(node); - attrCache = j === 0 ? null : attrCache; if (styleBuffer.value !== node.value || styleBuffer.attr !== node.attr) { stylesBuffer[i][j] = styles(node); @@ -1053,25 +1052,20 @@ AnsiTerminal.prototype.toString = function (type){ stylesBuffer[i][j].value = node.value; } + if (j === 0) { + s += ''; + attrCache = node.attr; + } else if (j === cols - 1) { + s += ''; + } + if (node.value) { - if (attrCache !== null && node.attr === attrCache) { - s += node.value; - - } else { - if (attrCache === null) { - s += ''; - } else { - s += node.value; - - if (j === cols - 1) { - s += ''; - } else { - s += ''; - } - } - + if (node.attr !== attrCache) { + s += ''; attrCache = node.attr; } + + s += node.value.replace(/\s/g, ' '); } }