From 6ed273d78170c7ce1d3303639caa96cd17c65d2d Mon Sep 17 00:00:00 2001 From: nuintun Date: Thu, 26 Nov 2015 11:23:30 +0800 Subject: [PATCH] update files --- static/js/terminal/lib/cursor.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/static/js/terminal/lib/cursor.js b/static/js/terminal/lib/cursor.js index f7ccbe0..caedbf7 100644 --- a/static/js/terminal/lib/cursor.js +++ b/static/js/terminal/lib/cursor.js @@ -15,7 +15,7 @@ module.exports = function (Terminal){ this.refresh(this.y, this.y); - if (this.cursorBlink && this._blink && this._blinker) { + if (this.cursorBlink && !this._blink && this._blinker) { this._blink = setInterval(this._blinker, this.cursorBlinkSpeed); } } @@ -32,8 +32,9 @@ module.exports = function (Terminal){ clearInterval(this._blink); + delete this._blink; + if (!this.cursorBlink) { - delete this._blink; delete this._blinker; } @@ -45,18 +46,22 @@ module.exports = function (Terminal){ * startBlink */ Terminal.prototype.startBlink = function (){ - if (this.cursor && this._cursor && this.cursorBlink && Terminal.focus === this) { + if (this.cursor && this.cursorBlink) { var context = this; clearInterval(this._blink); this._blinker = function (){ - context.cursorState ^= 1; + if (context._cursor) { + context.cursorState ^= 1; - context.refresh(context.y, context.y); + context.refresh(context.y, context.y); + } }; - this._blink = setInterval(this._blinker, this.cursorBlinkSpeed); + if (this._cursor) { + this._blink = setInterval(this._blinker, this.cursorBlinkSpeed); + } } };