From 10b9f8f8d92134051b7e9f34577846b26918239a Mon Sep 17 00:00:00 2001 From: nuintun Date: Thu, 3 Dec 2015 17:17:48 +0800 Subject: [PATCH] update files --- static/js/components/app-main/canvas-xterm.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/js/components/app-main/canvas-xterm.js b/static/js/components/app-main/canvas-xterm.js index ba09311..fe8f63f 100644 --- a/static/js/components/app-main/canvas-xterm.js +++ b/static/js/components/app-main/canvas-xterm.js @@ -23,6 +23,7 @@ function CanvasXTerm(font){ CanvasXTerm.prototype = { draw: function (screen){ var text = ''; + var width, height; var rows = screen.length; var cols = rows ? screen[0].length : 0; var node, i, j, x, y, attrCache, stylesCache; @@ -31,14 +32,21 @@ CanvasXTerm.prototype = { this.rows = rows; this.cols = cols; - this.canvas.width = this.measureWidth( + width = this.measureWidth( textRepeat('A', cols), 'italic bold ' + this.font.size + 'px ' + this.font.family ); - this.canvas.height = rows * this.font.lineHeight; + height = rows * this.font.lineHeight; + } else { + width = this.canvas.width; + height = this.canvas.height; } + // clear canvas + this.canvas.width = width; + this.canvas.height = height; + for (i = 0; i < rows; i++) { x = 0; y = i * this.font.lineHeight + this.baseY;