update files

This commit is contained in:
nuintun 2015-12-02 16:24:34 +08:00
parent 767945b247
commit e989c5ac7f

View File

@ -1030,6 +1030,7 @@ AnsiTerminal.prototype.toString = function (type){
var rows = this.screen.buffer.length; var rows = this.screen.buffer.length;
if (type === 'html') { if (type === 'html') {
var line = '';
var style = ''; var style = '';
var styleBuffer; var styleBuffer;
var attrCache; var attrCache;
@ -1041,7 +1042,7 @@ AnsiTerminal.prototype.toString = function (type){
stylesBuffer[i] = stylesBuffer[i] || []; stylesBuffer[i] = stylesBuffer[i] || [];
cols = this.screen.buffer[i].cells.length; cols = this.screen.buffer[i].cells.length;
s += '<div>'; line = '<div>';
for (j = 0; j < cols; ++j) { for (j = 0; j < cols; ++j) {
node = this.screen.buffer[i].cells[j]; node = this.screen.buffer[i].cells[j];
@ -1055,29 +1056,34 @@ AnsiTerminal.prototype.toString = function (type){
if (j === 0) { if (j === 0) {
style = htmlStyle(styleBuffer); style = htmlStyle(styleBuffer);
s += '<span' + (style ? ' style="' + style + '"' : '') + '>'; line += '<span' + (style ? ' style="' + style + '"' : '') + '>';
attrCache = node.attr; attrCache = node.attr;
} else if (j === cols) {
s += '</span>';
} }
if (node.value) { if (node.value) {
console.log(node, styles(node).foreground);
if (node.attr !== attrCache) { if (node.attr !== attrCache) {
style = htmlStyle(styleBuffer); style = htmlStyle(styleBuffer);
s += '</span><span' + (style ? ' style="' + style + '"' : '') + '>'; line += '</span><span' + (style ? ' style="' + style + '"' : '') + '>';
attrCache = node.attr; attrCache = node.attr;
} }
s += node.value.replace(/\s/g, '&nbsp;'); line += node.value.replace(/\s/g, '&nbsp;');
} }
} }
s += '</div>'; line += '</span></div>';
if (this.screen.buffer[i].version > 0) {
s += line;
} else {
s += '<div>&nbsp;</div>';
}
stylesBuffer[i][j] = styleBuffer; stylesBuffer[i][j] = styleBuffer;
} }
console.log(s);
this.stylesBuffer = stylesBuffer; this.stylesBuffer = stylesBuffer;
} else { } else {
for (i = 0; i < rows; ++i) { for (i = 0; i < rows; ++i) {