update files

This commit is contained in:
nuintun 2015-11-25 17:28:12 +08:00
parent d871c2b302
commit 092961802c
5 changed files with 21 additions and 11 deletions

View File

@ -15,6 +15,7 @@ module.exports = function (Terminal){
Terminal.prototype.showCursor = function (){ Terminal.prototype.showCursor = function (){
if (!this.cursorState) { if (!this.cursorState) {
this.cursorState = 1; this.cursorState = 1;
this.refresh(this.y, this.y); this.refresh(this.y, this.y);
} }
}; };

View File

@ -8,8 +8,11 @@ module.exports = function (Terminal){
Terminal.prototype.destroy = function (){ Terminal.prototype.destroy = function (){
this.readable = false; this.readable = false;
this.writable = false; this.writable = false;
this._events = {};
this.handler = function (){}; this.handler = function (){};
this.write = function (){}; this.write = function (){};
if (this.element.parentNode) {
this.element.parentNode.removeChild(this.element);
}
}; };
}; };

View File

@ -11,7 +11,7 @@ module.exports = function (Terminal){
Terminal.prototype.eraseRight = function (x, y){ Terminal.prototype.eraseRight = function (x, y){
var line = this.lines[this.ybase + y]; var line = this.lines[this.ybase + y];
var ch = [this.curAttr, ' ']; // xterm var ch = [this.eraseAttr(), ' '];
for (; x < this.cols; x++) { for (; x < this.cols; x++) {
line[x] = ch; line[x] = ch;
@ -22,7 +22,7 @@ module.exports = function (Terminal){
Terminal.prototype.eraseLeft = function (x, y){ Terminal.prototype.eraseLeft = function (x, y){
var line = this.lines[this.ybase + y]; var line = this.lines[this.ybase + y];
var ch = [this.curAttr, ' ']; // xterm var ch = [this.eraseAttr(), ' '];
x++; x++;

View File

@ -29,11 +29,21 @@ module.exports = function (Terminal){
* Open Terminal * Open Terminal
*/ */
Terminal.prototype.open = function (){ Terminal.prototype.open = function (){
var i = 0;
var div; var div;
var i = 0;
this.element = document.createElement('div'); this.element = document.createElement('div');
this.element.className = 'ui-terminal'; 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 = []; this.children = [];
for (; i < this.rows; i++) { for (; i < this.rows; i++) {
@ -49,9 +59,5 @@ module.exports = function (Terminal){
if (Terminal.brokenBold === null) { if (Terminal.brokenBold === null) {
Terminal.brokenBold = isBoldBroken(); Terminal.brokenBold = isBoldBroken();
} }
// sync default bg/fg colors
this.element.style.backgroundColor = this.bgColor;
this.element.style.color = this.fgColor;
}; };
}; };

View File

@ -7,7 +7,7 @@
// ignore warnings regarging == and != (coersion makes things work here appearently) // ignore warnings regarging == and != (coersion makes things work here appearently)
module.exports = function (Terminal){ module.exports = function (Terminal){
Terminal.prototype.setupStops = function (i){ Terminal.prototype.setupStops = function (i){
if (i !== undefined) { if (arguments.length) {
if (!this.tabs[i]) { if (!this.tabs[i]) {
i = this.prevStop(i); i = this.prevStop(i);
} }
@ -22,7 +22,7 @@ module.exports = function (Terminal){
}; };
Terminal.prototype.prevStop = function (x){ Terminal.prototype.prevStop = function (x){
if (x === undefined) x = this.x; if (!arguments.length) x = this.x;
while (!this.tabs[--x] && x > 0) {} while (!this.tabs[--x] && x > 0) {}
@ -30,7 +30,7 @@ module.exports = function (Terminal){
}; };
Terminal.prototype.nextStop = function (x){ Terminal.prototype.nextStop = function (x){
if (x === undefined) x = this.x; if (!arguments.length) x = this.x;
while (!this.tabs[++x] && x < this.cols) {} while (!this.tabs[++x] && x < this.cols) {}