diff --git a/static/js/terminal/index.js b/static/js/terminal/index.js
index bbfe2de..1064f83 100644
--- a/static/js/terminal/index.js
+++ b/static/js/terminal/index.js
@@ -1030,6 +1030,7 @@ AnsiTerminal.prototype.toString = function (type){
var rows = this.screen.buffer.length;
if (type === 'html') {
+ var line = '';
var style = '';
var styleBuffer;
var attrCache;
@@ -1041,7 +1042,7 @@ AnsiTerminal.prototype.toString = function (type){
stylesBuffer[i] = stylesBuffer[i] || [];
cols = this.screen.buffer[i].cells.length;
- s += '
';
+ line = '
';
for (j = 0; j < cols; ++j) {
node = this.screen.buffer[i].cells[j];
@@ -1055,29 +1056,34 @@ AnsiTerminal.prototype.toString = function (type){
if (j === 0) {
style = htmlStyle(styleBuffer);
- s += '';
+ line += '';
attrCache = node.attr;
- } else if (j === cols) {
- s += '';
}
if (node.value) {
- console.log(node, styles(node).foreground);
-
if (node.attr !== attrCache) {
style = htmlStyle(styleBuffer);
- s += '';
+ line += '';
attrCache = node.attr;
}
- s += node.value.replace(/\s/g, ' ');
+ line += node.value.replace(/\s/g, ' ');
}
}
- s += '
';
+ line += '
';
+
+ if (this.screen.buffer[i].version > 0) {
+ s += line;
+ } else {
+ s += '
';
+ }
+
stylesBuffer[i][j] = styleBuffer;
}
+ console.log(s);
+
this.stylesBuffer = stylesBuffer;
} else {
for (i = 0; i < rows; ++i) {