update files

This commit is contained in:
nuintun 2015-12-04 12:46:18 +08:00
parent 51e346f760
commit d229bb053c

View File

@ -40,10 +40,13 @@ CanvasXTerm.prototype = {
*/ */
draw: function (screen){ draw: function (screen){
var text = ''; var text = '';
var width, height; var context = this;
var rows = screen.rows; var rows = screen.rows;
var cols = screen.cols; var cols = screen.cols;
var node, i, j, x, y, attrCache, stylesCache; var attrCache = null;
var stylesCache = null;
var width, height;
var node, i, j, x, y;
if (!this.rows || !this.cols || this.rows !== rows || this.cols !== cols) { if (!this.rows || !this.cols || this.rows !== rows || this.cols !== cols) {
this.rows = rows; this.rows = rows;
@ -71,8 +74,13 @@ CanvasXTerm.prototype = {
var canvas; var canvas;
var brush; var brush;
for (i = 0; i < rows; i++) { function reset(){
text = ''; text = '';
attrCache = node.attr;
stylesCache = context.getStyles(node);
}
for (i = 0; i < rows; i++) {
x = 0; x = 0;
y = i * this.font.lineHeight; y = i * this.font.lineHeight;
line = this.lru.get(screen.buffer[i].id); line = this.lru.get(screen.buffer[i].id);
@ -92,16 +100,14 @@ CanvasXTerm.prototype = {
node = screen.buffer[i].cells[j]; node = screen.buffer[i].cells[j];
if (j === 0) { if (j === 0) {
attrCache = node.attr; reset();
stylesCache = this.getStyles(node);
} }
if (node.value) { if (node.value) {
if (node.attr !== attrCache) { if (node.attr !== attrCache) {
x = drawLine(brush, text, x, this.getStyles(stylesCache)); x = drawLine(brush, text, x, this.getStyles(stylesCache));
text = '';
attrCache = node.attr; reset();
stylesCache = this.getStyles(node);
} }
text += node.value; text += node.value;