From d229bb053cb7b71745f26f720582402adb6254a7 Mon Sep 17 00:00:00 2001 From: nuintun Date: Fri, 4 Dec 2015 12:46:18 +0800 Subject: [PATCH] update files --- static/js/terminal/canvas-xterm.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/static/js/terminal/canvas-xterm.js b/static/js/terminal/canvas-xterm.js index 27f51d9..4df9c07 100644 --- a/static/js/terminal/canvas-xterm.js +++ b/static/js/terminal/canvas-xterm.js @@ -40,10 +40,13 @@ CanvasXTerm.prototype = { */ draw: function (screen){ var text = ''; - var width, height; + var context = this; var rows = screen.rows; 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) { this.rows = rows; @@ -71,8 +74,13 @@ CanvasXTerm.prototype = { var canvas; var brush; - for (i = 0; i < rows; i++) { + function reset(){ text = ''; + attrCache = node.attr; + stylesCache = context.getStyles(node); + } + + for (i = 0; i < rows; i++) { x = 0; y = i * this.font.lineHeight; line = this.lru.get(screen.buffer[i].id); @@ -92,16 +100,14 @@ CanvasXTerm.prototype = { node = screen.buffer[i].cells[j]; if (j === 0) { - attrCache = node.attr; - stylesCache = this.getStyles(node); + reset(); } if (node.value) { if (node.attr !== attrCache) { x = drawLine(brush, text, x, this.getStyles(stylesCache)); - text = ''; - attrCache = node.attr; - stylesCache = this.getStyles(node); + + reset(); } text += node.value;