mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-07 11:34:05 +08:00
update files
This commit is contained in:
parent
07eb2b8b48
commit
26c6e9635d
@ -53,36 +53,24 @@ function scroll(xterm, parent){
|
||||
* @param xtermNode
|
||||
*/
|
||||
function createXTerm(name, xtermNode){
|
||||
var timer;
|
||||
var runtime = window.AppRuntime[name];
|
||||
|
||||
xtermNode.innerHTML = '';
|
||||
|
||||
if (runtime) {
|
||||
runtime.xterm.focus();
|
||||
xtermNode.appendChild(runtime.xterm.element);
|
||||
} else {
|
||||
var xterm = new Terminal({
|
||||
rows: 66,
|
||||
scrollback: 66,
|
||||
convertEOL: true,
|
||||
fgColor: 'inherit',
|
||||
bgColor: 'transparent',
|
||||
onscreen: function (screen){
|
||||
if (this.isFocused()) {
|
||||
setImmediate(function (){
|
||||
xtermNode.innerHTML = screen;
|
||||
scroll(xterm, xtermNode);
|
||||
});
|
||||
//clearTimeout(timer);
|
||||
|
||||
//timer = setTimeout(function (){
|
||||
// xtermNode.innerHTML = screen;
|
||||
//}, 0);
|
||||
//
|
||||
//scroll(xterm, xtermNode);
|
||||
}
|
||||
}
|
||||
bgColor: 'transparent'
|
||||
});
|
||||
|
||||
xterm.open();
|
||||
xtermNode.appendChild(xterm.element);
|
||||
|
||||
window.AppRuntime[name] = {
|
||||
xterm: xterm
|
||||
@ -193,10 +181,13 @@ module.exports = Vue.component('app-main', {
|
||||
}, false);
|
||||
|
||||
ipc.on('emulator', function (event, type, project, data){
|
||||
var xtermNode = context.$els.terminal;
|
||||
var runtime = window.AppRuntime[project.name];
|
||||
|
||||
if (runtime) {
|
||||
xtermNode.innerHTML = '';
|
||||
runtime.xterm.write(data + '');
|
||||
xtermNode.appendChild(runtime.xterm.element);
|
||||
} else {
|
||||
event.sender.send('emulator', project, 'stop');
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ function Terminal(options){
|
||||
this.charsets = [null];
|
||||
|
||||
// misc
|
||||
this.element = null;
|
||||
this.screen = null;
|
||||
this.children = [];
|
||||
this.refreshStart = null;
|
||||
this.refreshEnd = null;
|
||||
|
@ -15,16 +15,16 @@ module.exports = function (Terminal){
|
||||
this.writable = false;
|
||||
this.write = function (){};
|
||||
this.ondata = function (){};
|
||||
this.ondataTitle = function (){};
|
||||
this.ontitle = function (){};
|
||||
|
||||
if (this.element) {
|
||||
var parent = this.element.parentNode;
|
||||
if (this.screen) {
|
||||
var parent = this.screen.parentNode;
|
||||
|
||||
if (parent) {
|
||||
parent.removeChild(this.element);
|
||||
parent.removeChild(this.screen);
|
||||
}
|
||||
|
||||
this.element = null;
|
||||
this.screen = null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ module.exports = function (Terminal){
|
||||
// -this.vt200Mouse = params === 1000;
|
||||
// -this.normalMouse = params > 1000;
|
||||
// -this.mouseEvents = true;
|
||||
// -this.element.style.cursor = 'default';
|
||||
// -this.screen.style.cursor = 'default';
|
||||
break;
|
||||
// send focusin/focusout events
|
||||
case 1004:
|
||||
@ -364,7 +364,7 @@ module.exports = function (Terminal){
|
||||
// -this.vt200Mouse = false;
|
||||
// -this.normalMouse = false;
|
||||
// -this.mouseEvents = false;
|
||||
// -this.element.style.cursor = '';
|
||||
// -this.screen.style.cursor = '';
|
||||
break;
|
||||
// send focusin/focusout events
|
||||
case 1004:
|
||||
|
@ -9,21 +9,20 @@ module.exports = function (Terminal){
|
||||
Terminal.prototype.reset = function (){
|
||||
var parent;
|
||||
|
||||
if (this.element) {
|
||||
parent = this.element.parentNode;
|
||||
if (this.screen) {
|
||||
parent = this.screen.parentNode;
|
||||
|
||||
if (parent) {
|
||||
parent.removeChild(this.element);
|
||||
parent.removeChild(this.screen);
|
||||
}
|
||||
}
|
||||
|
||||
Terminal.call(this, this.options);
|
||||
|
||||
this.open();
|
||||
this.refresh(0, this.rows - 1);
|
||||
|
||||
if (parent) {
|
||||
parent.appendChild(this.element);
|
||||
parent.appendChild(this.screen);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -32,16 +32,16 @@ module.exports = function (Terminal){
|
||||
var div;
|
||||
var i = 0;
|
||||
|
||||
this.element = document.createElement('div');
|
||||
this.element.className = 'ui-terminal';
|
||||
this.element.style.outline = 'none';
|
||||
this.screen = document.createElement('div');
|
||||
this.screen.className = 'ui-terminal';
|
||||
this.screen.style.outline = 'none';
|
||||
|
||||
this.element.setAttribute('tabindex', '0');
|
||||
this.element.setAttribute('spellcheck', 'false');
|
||||
this.screen.setAttribute('tabindex', '0');
|
||||
this.screen.setAttribute('spellcheck', 'false');
|
||||
|
||||
// sync default bg/fg colors
|
||||
this.element.style.backgroundColor = this.bgColor;
|
||||
this.element.style.color = this.fgColor;
|
||||
this.screen.style.backgroundColor = this.bgColor;
|
||||
this.screen.style.color = this.fgColor;
|
||||
|
||||
// Create the lines for our terminal.
|
||||
this.children = [];
|
||||
@ -49,7 +49,7 @@ module.exports = function (Terminal){
|
||||
for (; i < this.rows; i++) {
|
||||
div = document.createElement('div');
|
||||
|
||||
this.element.appendChild(div);
|
||||
this.screen.appendChild(div);
|
||||
this.children.push(div);
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,12 @@ module.exports = function (Terminal){
|
||||
* @param end
|
||||
*/
|
||||
Terminal.prototype.refresh = function (start, end){
|
||||
var parent = this.element ? this.element.parentNode : null;
|
||||
var parent = this.screen ? this.screen.parentNode : null;
|
||||
var optimize = parent && end - start >= this.rows / 2;
|
||||
var x, y, i, line, out, ch, width, data, attr, fgColor, bgColor, flags, row;
|
||||
|
||||
if (optimize) {
|
||||
parent.removeChild(this.element);
|
||||
parent.removeChild(this.screen);
|
||||
}
|
||||
|
||||
width = this.cols;
|
||||
@ -154,7 +154,7 @@ module.exports = function (Terminal){
|
||||
}
|
||||
|
||||
if (optimize) {
|
||||
parent.appendChild(this.element);
|
||||
parent.appendChild(this.screen);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ module.exports = function (Terminal){
|
||||
* @param y
|
||||
*/
|
||||
Terminal.prototype.resize = function (x, y){
|
||||
var line, element, i, j, ch;
|
||||
var line, screen, i, j, ch;
|
||||
|
||||
if (x < 1) x = 1;
|
||||
|
||||
@ -48,7 +48,7 @@ module.exports = function (Terminal){
|
||||
j = this.rows;
|
||||
|
||||
if (j < y) {
|
||||
element = this.element;
|
||||
screen = this.screen;
|
||||
|
||||
while (j++ < y) {
|
||||
if (this.lines.length < y + this.ybase) {
|
||||
@ -58,7 +58,7 @@ module.exports = function (Terminal){
|
||||
if (this.children.length < y) {
|
||||
line = this.document.createElement('div');
|
||||
|
||||
element.appendChild(line);
|
||||
screen.appendChild(line);
|
||||
|
||||
this.children.push(line);
|
||||
}
|
||||
@ -70,11 +70,11 @@ module.exports = function (Terminal){
|
||||
}
|
||||
|
||||
if (this.children.length > y) {
|
||||
element = this.children.pop();
|
||||
screen = this.children.pop();
|
||||
|
||||
if (!element) continue;
|
||||
if (!screen) continue;
|
||||
|
||||
element.parentNode.removeChild(element);
|
||||
screen.parentNode.removeChild(screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ module.exports = function (Terminal){
|
||||
|
||||
var context = this;
|
||||
|
||||
this.element.style.borderColor = 'white';
|
||||
this.screen.style.borderColor = 'white';
|
||||
|
||||
setTimeout(function (){
|
||||
context.element.style.borderColor = '';
|
||||
context.screen.style.borderColor = '';
|
||||
}, 10);
|
||||
|
||||
if (this.popOnBell) this.focus();
|
||||
|
Loading…
x
Reference in New Issue
Block a user