From 130100e053d58dd49bf3fea3373101bddecb7470 Mon Sep 17 00:00:00 2001 From: nuintun Date: Fri, 4 Dec 2015 16:25:19 +0800 Subject: [PATCH] update files --- static/js/terminal/canvas-xterm.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/static/js/terminal/canvas-xterm.js b/static/js/terminal/canvas-xterm.js index e16d522..512c299 100644 --- a/static/js/terminal/canvas-xterm.js +++ b/static/js/terminal/canvas-xterm.js @@ -46,7 +46,7 @@ CanvasXTerm.prototype = { var attrCache = null; var stylesCache = null; var width, height; - var node, i, j, x, y; + var node, i, j, x, y, line, canvas, brush; if (!this.rows || !this.cols || this.rows !== rows || this.cols !== cols) { this.rows = rows; @@ -70,10 +70,6 @@ CanvasXTerm.prototype = { this.canvas.width = width; this.canvas.height = height; - var line; - var canvas; - var brush; - function reset(){ text = ''; attrCache = node.attr; @@ -81,9 +77,15 @@ CanvasXTerm.prototype = { } for (i = 0; i < rows; i++) { + line = screen.buffer[i]; + + if (!line) { + continue; + } + x = 0; y = i * this.font.lineHeight; - line = this.lru.get(screen.buffer[i].id); + line = this.lru.get(line.id); if (line && line.version === screen.buffer[i].version) { this.brush.drawImage(line.canvas, 0, y, line.canvas.width, line.canvas.height); @@ -99,6 +101,10 @@ CanvasXTerm.prototype = { for (j = 0; j < cols; j++) { node = screen.buffer[i].cells[j]; + if (!node) { + continue; + } + if (j === 0) { reset(); }