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;