diff --git a/static/js/components/app-main/index.js b/static/js/components/app-main/index.js index 12cfe46..4705fb6 100644 --- a/static/js/components/app-main/index.js +++ b/static/js/components/app-main/index.js @@ -181,6 +181,8 @@ module.exports = Vue.component('app-main', { context.expandCommand = trigger && trigger.contains(target); }, false); + var timer; + ipc.on('emulator', function (event, type, project, data){ var xtermNode = context.$els.terminal; var runtime = window.AppRuntime[project.name]; @@ -188,7 +190,10 @@ module.exports = Vue.component('app-main', { if (runtime) { xtermNode.innerHTML = ''; runtime.xterm.write(data + ''); - xtermNode.appendChild(runtime.xterm.screen); + if(runtime.xterm.isFu) + setTimeout(function (){ + xtermNode.appendChild(runtime.xterm.screen); + }, 1); } else { event.sender.send('emulator', project, 'stop'); } diff --git a/static/js/terminal/lib/focused.js b/static/js/terminal/lib/focused.js index 7e4a494..f8abcf4 100644 --- a/static/js/terminal/lib/focused.js +++ b/static/js/terminal/lib/focused.js @@ -7,6 +7,14 @@ module.exports = function (Terminal){ Terminal.focus = null; + /** + * isFocused + * @returns {boolean} + */ + Terminal.prototype.isFocused = function (){ + return Terminal.focus === this; + }; + /** * focus */ @@ -17,6 +25,8 @@ module.exports = function (Terminal){ Terminal.focus.blur(); } + Terminal.focus = this; + if (this.cursor) { this.showCursor(); } @@ -24,8 +34,6 @@ module.exports = function (Terminal){ if (this.cursorBlink) { this.startBlink(); } - - Terminal.focus = this; }; /**