diff --git a/static/js/terminal/lib/cursor.js b/static/js/terminal/lib/cursor.js index db645e2..e154247 100644 --- a/static/js/terminal/lib/cursor.js +++ b/static/js/terminal/lib/cursor.js @@ -15,6 +15,7 @@ module.exports = function (Terminal){ Terminal.prototype.showCursor = function (){ if (!this.cursorState) { this.cursorState = 1; + this.refresh(this.y, this.y); } }; diff --git a/static/js/terminal/lib/destroy.js b/static/js/terminal/lib/destroy.js index 0ebdf61..80fd727 100644 --- a/static/js/terminal/lib/destroy.js +++ b/static/js/terminal/lib/destroy.js @@ -8,8 +8,11 @@ module.exports = function (Terminal){ Terminal.prototype.destroy = function (){ this.readable = false; this.writable = false; - this._events = {}; this.handler = function (){}; this.write = function (){}; + + if (this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } }; }; diff --git a/static/js/terminal/lib/erase.js b/static/js/terminal/lib/erase.js index 944f49d..8694527 100644 --- a/static/js/terminal/lib/erase.js +++ b/static/js/terminal/lib/erase.js @@ -11,7 +11,7 @@ module.exports = function (Terminal){ Terminal.prototype.eraseRight = function (x, y){ var line = this.lines[this.ybase + y]; - var ch = [this.curAttr, ' ']; // xterm + var ch = [this.eraseAttr(), ' ']; for (; x < this.cols; x++) { line[x] = ch; @@ -22,7 +22,7 @@ module.exports = function (Terminal){ Terminal.prototype.eraseLeft = function (x, y){ var line = this.lines[this.ybase + y]; - var ch = [this.curAttr, ' ']; // xterm + var ch = [this.eraseAttr(), ' ']; x++; diff --git a/static/js/terminal/lib/open.js b/static/js/terminal/lib/open.js index 540ccd5..52b58d1 100644 --- a/static/js/terminal/lib/open.js +++ b/static/js/terminal/lib/open.js @@ -29,11 +29,21 @@ module.exports = function (Terminal){ * Open Terminal */ Terminal.prototype.open = function (){ - var i = 0; var div; + var i = 0; this.element = document.createElement('div'); this.element.className = 'ui-terminal'; + this.element.style.outline = 'none'; + + this.element.setAttribute('tabindex', '0'); + this.element.setAttribute('spellcheck', 'false'); + + // sync default bg/fg colors + this.element.style.backgroundColor = this.bgColor; + this.element.style.color = this.fgColor; + + // Create the lines for our terminal. this.children = []; for (; i < this.rows; i++) { @@ -49,9 +59,5 @@ module.exports = function (Terminal){ if (Terminal.brokenBold === null) { Terminal.brokenBold = isBoldBroken(); } - - // sync default bg/fg colors - this.element.style.backgroundColor = this.bgColor; - this.element.style.color = this.fgColor; }; }; diff --git a/static/js/terminal/lib/stops.js b/static/js/terminal/lib/stops.js index 53670aa..5bcd7e7 100644 --- a/static/js/terminal/lib/stops.js +++ b/static/js/terminal/lib/stops.js @@ -7,7 +7,7 @@ // ignore warnings regarging == and != (coersion makes things work here appearently) module.exports = function (Terminal){ Terminal.prototype.setupStops = function (i){ - if (i !== undefined) { + if (arguments.length) { if (!this.tabs[i]) { i = this.prevStop(i); } @@ -22,7 +22,7 @@ module.exports = function (Terminal){ }; Terminal.prototype.prevStop = function (x){ - if (x === undefined) x = this.x; + if (!arguments.length) x = this.x; while (!this.tabs[--x] && x > 0) {} @@ -30,7 +30,7 @@ module.exports = function (Terminal){ }; Terminal.prototype.nextStop = function (x){ - if (x === undefined) x = this.x; + if (!arguments.length) x = this.x; while (!this.tabs[++x] && x < this.cols) {}