update files

This commit is contained in:
nuintun
2015-11-26 21:43:25 +08:00
parent d3b1f33b9f
commit 4f037c405f
6 changed files with 18 additions and 68 deletions

View File

@@ -16,20 +16,22 @@ module.exports = function (Terminal){
// Next 14 bits: a mask for misc.
// flags: 1=bold, 2=underline, 4=blink, 8=inverse, 16=invisible
function screen(foreground, background, content){
var intro = '<div class="ui-terminal" tabindex="0" spellcheck="false" '
+ 'style="outline:none;background-color:' + background + ' ; color:' + foreground + ';">';
var outro = '</div>';
return intro + content + outro;
}
/**
* refresh
* @param start
* @param end
*/
Terminal.prototype.refresh = function (start, end){
var parent = this.element ? this.element.parentNode : null;
var optimize = parent && end - start >= this.rows / 2;
var x, y, i, line, out, ch, width, data, attr, fgColor, bgColor, flags, row;
if (optimize) {
parent.removeChild(this.element);
}
width = this.cols;
y = start;
@@ -150,11 +152,9 @@ module.exports = function (Terminal){
out += '</span>';
}
this.children[y].innerHTML = out;
this.screenLines[y] = '<div>' + out + '</div>';
}
if (optimize) {
parent.appendChild(this.element);
}
this.screen = screen(this.fgColor, this.bgColor, this.screenLines.join(''));
};
};