From fe56467a2e8a32691d3b0b5ad735cd38f3cffdcb Mon Sep 17 00:00:00 2001 From: nuintun Date: Wed, 25 Nov 2015 12:41:42 +0800 Subject: [PATCH] update files --- static/js/terminal/index.js | 3 +++ static/js/terminal/lib/cursor.js | 4 ++-- static/js/terminal/lib/write.js | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/static/js/terminal/index.js b/static/js/terminal/index.js index 64700e0..682c837 100644 --- a/static/js/terminal/index.js +++ b/static/js/terminal/index.js @@ -53,6 +53,9 @@ function Terminal(options){ this.bgColor = options.bgColor || Terminal.defaultColors.bgColor; this.fgColor = options.fgColor || Terminal.defaultColors.fgColor; + options.handler = typeof options.handler === 'function' ? options.handler : function (){}; + this.handler = options.handler; + this.options = options; this.ybase = 0; diff --git a/static/js/terminal/lib/cursor.js b/static/js/terminal/lib/cursor.js index fdd752a..db645e2 100644 --- a/static/js/terminal/lib/cursor.js +++ b/static/js/terminal/lib/cursor.js @@ -22,10 +22,10 @@ module.exports = function (Terminal){ Terminal.prototype.startBlink = function (){ if (!this.cursorBlink) return; - var self = this; + var context = this; this._blinker = function (){ - self.blinkCursor(); + context.blinkCursor(); }; this._blink = setInterval(this._blinker, 500); diff --git a/static/js/terminal/lib/write.js b/static/js/terminal/lib/write.js index 5437031..1bf3e49 100644 --- a/static/js/terminal/lib/write.js +++ b/static/js/terminal/lib/write.js @@ -18,12 +18,12 @@ module.exports = function (Terminal){ if (!this.visualBell) return; - var self = this; + var context = this; this.element.style.borderColor = 'white'; setTimeout(function (){ - self.element.style.borderColor = ''; + context.element.style.borderColor = ''; }, 10); if (this.popOnBell) this.focus(); @@ -695,31 +695,39 @@ module.exports = function (Terminal){ // Request Status String (DECRQSS). // test: echo -e '\eP$q"p\e\\' case '$q': - var pt = this.currentParam, - valid = false; + var valid = 0; + var pt = this.currentParam; + switch (pt) { // DECSCA case '"q': pt = '0"q'; + valid = 1; break; // DECSCL case '"p': pt = '61"p'; + valid = 1; break; // DECSTBM case 'r': pt = '' + (this.scrollTop + 1) + ';' + (this.scrollBottom + 1) + 'r'; + valid = 1; break; // SGR case 'm': pt = '0m'; + valid = 1; break; default: this.error('Unknown DCS Pt: %s.', pt); + valid = 0; pt = ''; break; } + + // -this.send('\x1bP' + valid + '$r' + pt + '\x1b\\'); break; // Set Termcap/Terminfo Data (xterm, experimental). case '+p':