mirror of
https://github.com/nuintun/command-manager.git
synced 2025-07-23 03:09:37 +08:00
update files
This commit is contained in:
parent
4f037c405f
commit
6b2c31b263
@ -70,17 +70,21 @@ function Terminal(options){
|
|||||||
this.cols = options.cols;
|
this.cols = options.cols;
|
||||||
this.rows = options.rows;
|
this.rows = options.rows;
|
||||||
|
|
||||||
// set handler
|
// set ondata
|
||||||
options.handler = typeof options.handler === 'function' ? options.handler : function (){};
|
options.ondata = typeof options.ondata === 'function' ? options.ondata : function (){};
|
||||||
this.handler = options.handler;
|
this.ondata = options.ondata;
|
||||||
|
|
||||||
// set handle title
|
// set ontitle
|
||||||
options.handleTitle = typeof options.handleTitle === 'function' ? options.handleTitle : function (){};
|
options.ontitle = typeof options.ontitle === 'function' ? options.ontitle : function (){};
|
||||||
this.handleTitle = options.handleTitle;
|
this.ontitle = options.ontitle;
|
||||||
|
|
||||||
|
// set onscreen
|
||||||
|
options.onscreen = typeof options.onscreen === 'function' ? options.onscreen : function (){};
|
||||||
|
this.onscreen = options.onscreen;
|
||||||
|
|
||||||
// set convert eol
|
// set convert eol
|
||||||
options.convertEol = options.convertEol === true;
|
options.convertEOL = options.convertEOL === true;
|
||||||
this.convertEol = options.convertEol;
|
this.convertEOL = options.convertEOL;
|
||||||
|
|
||||||
// set options
|
// set options
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
@ -15,7 +15,7 @@ module.exports = function (Terminal){
|
|||||||
this.readable = false;
|
this.readable = false;
|
||||||
this.writable = false;
|
this.writable = false;
|
||||||
this.write = function (){};
|
this.write = function (){};
|
||||||
this.handler = function (){};
|
this.ondata = function (){};
|
||||||
this.handlerTitle = function (){};
|
this.ontitle = function (){};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,6 @@ module.exports = function (Terminal){
|
|||||||
Terminal.cursor = true;
|
Terminal.cursor = true;
|
||||||
Terminal.cursorBlink = true;
|
Terminal.cursorBlink = true;
|
||||||
Terminal.cursorBlinkSpeed = 500;
|
Terminal.cursorBlinkSpeed = 500;
|
||||||
Terminal.visualBell = true;
|
|
||||||
Terminal.popOnBell = true;
|
Terminal.popOnBell = true;
|
||||||
Terminal.scrollback = 640;
|
Terminal.scrollback = 640;
|
||||||
Terminal.screenKeys = false;
|
Terminal.screenKeys = false;
|
||||||
@ -24,7 +23,6 @@ module.exports = function (Terminal){
|
|||||||
cursor: Terminal.cursor,
|
cursor: Terminal.cursor,
|
||||||
cursorBlink: Terminal.cursorBlink,
|
cursorBlink: Terminal.cursorBlink,
|
||||||
cursorBlinkSpeed: Terminal.cursorBlinkSpeed,
|
cursorBlinkSpeed: Terminal.cursorBlinkSpeed,
|
||||||
visualBell: Terminal.visualBell,
|
|
||||||
popOnBell: Terminal.popOnBell,
|
popOnBell: Terminal.popOnBell,
|
||||||
scrollback: Terminal.scrollback,
|
scrollback: Terminal.scrollback,
|
||||||
screenKeys: Terminal.screenKeys,
|
screenKeys: Terminal.screenKeys,
|
||||||
|
@ -156,5 +156,7 @@ module.exports = function (Terminal){
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.screen = screen(this.fgColor, this.bgColor, this.screenLines.join(''));
|
this.screen = screen(this.fgColor, this.bgColor, this.screenLines.join(''));
|
||||||
|
|
||||||
|
this.onscreen.call(this, this.screen);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ module.exports = function (Terminal){
|
|||||||
|
|
||||||
if (!this.queue) {
|
if (!this.queue) {
|
||||||
setTimeout(function (){
|
setTimeout(function (){
|
||||||
context.handler(context.queue);
|
context.ondata.call(context, context.queue);
|
||||||
|
|
||||||
context.queue = '';
|
context.queue = '';
|
||||||
}, 1);
|
}, 1);
|
||||||
@ -30,19 +30,9 @@ module.exports = function (Terminal){
|
|||||||
*/
|
*/
|
||||||
Terminal.prototype.bell = function (){
|
Terminal.prototype.bell = function (){
|
||||||
// buffers automatically when created
|
// buffers automatically when created
|
||||||
var snd = new Audio('bell.wav');
|
var bell = new Audio('bell.wav');
|
||||||
|
|
||||||
snd.play();
|
bell.play();
|
||||||
|
|
||||||
if (!this.visualBell) return;
|
|
||||||
|
|
||||||
var context = this;
|
|
||||||
|
|
||||||
this.element.style.borderColor = 'white';
|
|
||||||
|
|
||||||
setTimeout(function (){
|
|
||||||
context.element.style.borderColor = '';
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
if (this.popOnBell) this.focus();
|
if (this.popOnBell) this.focus();
|
||||||
};
|
};
|
||||||
@ -80,7 +70,7 @@ module.exports = function (Terminal){
|
|||||||
case '\n':
|
case '\n':
|
||||||
case '\x0b':
|
case '\x0b':
|
||||||
case '\x0c':
|
case '\x0c':
|
||||||
if (this.convertEol) {
|
if (this.convertEOL) {
|
||||||
this.x = 0;
|
this.x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +414,7 @@ module.exports = function (Terminal){
|
|||||||
case 2:
|
case 2:
|
||||||
if (this.params[1]) {
|
if (this.params[1]) {
|
||||||
this.title = this.params[1];
|
this.title = this.params[1];
|
||||||
this.handleTitle(this.title);
|
this.ontitle.call(this, this.title);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user