diff --git a/lib/widgets/screen.js b/lib/widgets/screen.js index a443c44..0370e60 100644 --- a/lib/widgets/screen.js +++ b/lib/widgets/screen.js @@ -717,6 +717,8 @@ Screen.prototype.alloc = function() { Screen.prototype.render = function() { var self = this; + if (this.destroyed) return; + this.emit('prerender'); this._borderStops = {}; diff --git a/lib/widgets/terminal.js b/lib/widgets/terminal.js index cc857f4..cf645e8 100644 --- a/lib/widgets/terminal.js +++ b/lib/widgets/terminal.js @@ -212,7 +212,7 @@ Terminal.prototype.bootstrap = function() { this.on('destroy', function() { self.kill(); - self.screen.program.removeListener('data', self._onData); + self.screen.program.input.removeListener('data', self._onData); }); if (this.handler) { @@ -403,6 +403,10 @@ Terminal.prototype.kill = function() { } this.term.refresh = function() {}; this.term.write('\x1b[H\x1b[J'); + if (this.term._blink) { + clearInterval(this.term._blink); + } + this.term.destroy(); }; /**