update files

This commit is contained in:
nuintun 2015-11-26 17:13:52 +08:00
parent 0de48027f7
commit 887e6a74d4
3 changed files with 14 additions and 10 deletions

View File

@ -34,8 +34,6 @@ Emulator.prototype = {
exec: function (){
var parsed = normalizeExecArgs.apply(null, arguments);
console.log(JSON.stringify(parsed, null, 2));
return spawn(parsed.shell, parsed.args, parsed.options);
}
};
@ -95,10 +93,6 @@ module.exports = {
env[item.name] = item.value
});
env['COLORTERM'] = 'true';
env['DEBUG_FD'] = '1';
env['DEBUG_COLORS'] = 'true';
emulator = new Emulator({
env: env,
cwd: project.path,

View File

@ -192,6 +192,8 @@ module.exports = Vue.component('app-main', {
context.expandCommand = trigger && trigger.contains(target);
}, false);
var step = 0;
ipc.on('emulator', function (event, type, project, data){
var runtime = window.AppRuntime[project.name];
@ -199,17 +201,22 @@ module.exports = Vue.component('app-main', {
switch (type) {
case 'data':
data += '';
step++;
break;
case 'error':
data = '执行出现错误: ' + data;
step = 0;
break;
case 'close':
data = '\u001b[32m命令执行完毕\u001b[39m\r\n';
step = 0;
break;
}
setTimeout(function (){
runtime.xterm.write(data + '');
scroll(runtime.xterm);
}, 10 * step);
} else {
event.sender.send('emulator', project, 'stop');
}

View File

@ -23,9 +23,10 @@ module.exports = function (Terminal){
*/
Terminal.prototype.refresh = function (start, end){
var parent = this.element ? this.element.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 (parent && end - start >= this.rows / 2) {
if (optimize) {
parent.removeChild(this.element);
}
@ -152,6 +153,8 @@ module.exports = function (Terminal){
this.children[y].innerHTML = out;
}
if (parent) parent.appendChild(this.element);
if (optimize) {
parent.appendChild(this.element);
}
};
};