update files

This commit is contained in:
nuintun
2015-11-26 10:53:50 +08:00
parent f763bf9759
commit ef1690ae5f
12 changed files with 130 additions and 35 deletions

View File

@@ -5,6 +5,11 @@
'use strict';
module.exports = function (Terminal){
/**
* blankLine
* @param cur
* @returns {Array}
*/
Terminal.prototype.blankLine = function (cur){
var attr = cur ? this.eraseAttr() : this.defAttr;
var ch = [attr, ' '];

View File

@@ -48,7 +48,7 @@ module.exports = function (Terminal){
'}': '\u00a3', // '£'
'~': '\u00b7' // '·'
};
Terminal.charsets.UK = null; // (A
Terminal.charsets.US = null; // (B (USASCII)
Terminal.charsets.Dutch = null; // (4

View File

@@ -5,6 +5,9 @@
'use strict';
module.exports = function (Terminal){
/**
* close
*/
Terminal.prototype.close = function (){
this.lines = [];
this.children = [];

View File

@@ -5,6 +5,13 @@
'use strict';
module.exports = function (Terminal){
/**
* matchColor
* @param r1
* @param g1
* @param b1
* @returns {*}
*/
function matchColor(r1, g1, b1){
var hash = (r1 << 16) | (g1 << 8) | b1;

View File

@@ -189,7 +189,9 @@ module.exports = function (Terminal){
break;
// show cursor
case 25:
this.cursorHidden = false;
this.cursor = true;
this.showCursor();
break;
// alt screen buffer cursor
case 1049:
@@ -382,7 +384,9 @@ module.exports = function (Terminal){
break;
// hide cursor
case 25:
this.cursorHidden = true;
this.cursor = false;
this.hideCursor();
break;
// alt screen buffer cursor
case 1049:

View File

@@ -8,7 +8,6 @@ module.exports = function (Terminal){
// CSI ! p Soft terminal reset (DECSTR).
// http://vt100.net/docs/vt220-rm/table4-10.html
Terminal.prototype.softReset = function (){
this.cursorHidden = false;
this.insertMode = false;
this.originMode = false;
// autowrap

View File

@@ -5,38 +5,73 @@
'use strict';
module.exports = function (Terminal){
Terminal.prototype.blinkCursor = function (){
if (Terminal.focus !== this) return;
this.cursorState ^= 1;
this.refresh(this.y, this.y);
};
/**
* showCursor
*/
Terminal.prototype.showCursor = function (){
if (!this.cursorState) {
if (this.cursor) {
this._cursor = true;
this.cursorState = 1;
this.refresh(this.y, this.y);
}
};
Terminal.prototype.startBlink = function (){
if (!this.cursorBlink) return;
/**
* hideCursor
*/
Terminal.prototype.hideCursor = function (){
if (this._cursor) {
delete this._cursor;
var context = this;
this.cursorState = 0;
this._blinker = function (){
context.blinkCursor();
};
if (this._blink && this._blinker) {
clearInterval(this._blink);
this._blink = setInterval(this._blinker, 500);
delete this._blink;
delete this._blinker;
}
this.refresh(this.y, this.y);
}
};
Terminal.prototype.refreshBlink = function (){
if (!this.cursorBlink) return;
/**
* startBlink
*/
Terminal.prototype.startBlink = function (){
if (this.cursor && this.cursorBlink && Terminal.focus === this) {
var context = this;
clearInterval(this._blink);
this.stopBlink();
this._blinker = function (){
context.cursorState ^= 1;
this._blink = setInterval(this._blinker, 500);
context.refresh(this.y, this.y);
};
this._blink = setInterval(this._blinker, this.cursorBlinkSpeed);
}
};
/**
* stopBlink
*/
Terminal.prototype.stopBlink = function (){
if (this._blink && this._blinker) {
clearInterval(this._blink);
delete this._blink;
delete this._blinker;
if (this.cursor && this._cursor) {
this.cursorState = 1;
} else {
this.cursorState = 0;
}
this.refresh(this.y, this.y);
}
};
};

View File

@@ -22,8 +22,7 @@ module.exports = function (Terminal){
Terminal.prototype.blur = function (){
if (Terminal.focus !== this) return;
this.cursorState = 0;
this.refresh(this.y, this.y);
this.hideCursor();
Terminal.focus = null;
};

View File

@@ -8,7 +8,9 @@ module.exports = function (Terminal){
Terminal.termName = 'xterm';
Terminal.debug = false;
Terminal.geometry = [100, 80];
Terminal.cursor = true;
Terminal.cursorBlink = true;
Terminal.cursorBlinkSpeed = 500;
Terminal.visualBell = true;
Terminal.popOnBell = true;
Terminal.scrollback = 640;
@@ -19,7 +21,9 @@ module.exports = function (Terminal){
Terminal.defaults = {
debug: Terminal.debug,
termName: Terminal.termName,
cursor: Terminal.cursor,
cursorBlink: Terminal.cursorBlink,
cursorBlinkSpeed: Terminal.cursorBlinkSpeed,
visualBell: Terminal.visualBell,
popOnBell: Terminal.popOnBell,
scrollback: Terminal.scrollback,

View File

@@ -40,7 +40,7 @@ module.exports = function (Terminal){
row = y + this.ydisp;
line = this.lines[row];
if (y === this.y && this.cursorState && this.ydisp === this.ybase && !this.cursorHidden) {
if (y === this.y && this.cursor && this.cursorState && this.ydisp === this.ybase) {
x = this.x;
} else {
x = -1;

View File

@@ -6,6 +6,10 @@
// ignore warnings regarging == and != (coersion makes things work here appearently)
module.exports = function (Terminal){
/**
* setupStops
* @param i
*/
Terminal.prototype.setupStops = function (i){
if (arguments.length) {
if (!this.tabs[i]) {
@@ -21,6 +25,11 @@ module.exports = function (Terminal){
}
};
/**
* prevStop
* @param x
* @returns {number}
*/
Terminal.prototype.prevStop = function (x){
if (!arguments.length) x = this.x;
@@ -29,6 +38,11 @@ module.exports = function (Terminal){
return x >= this.cols ? this.cols - 1 : x < 0 ? 0 : x;
};
/**
* nextStop
* @param x
* @returns {number}
*/
Terminal.prototype.nextStop = function (x){
if (!arguments.length) x = this.x;