improve screen.setTerminal.

This commit is contained in:
Christopher Jeffrey 2015-08-05 21:26:39 -07:00
parent 210c33d076
commit 3df75398a0
1 changed files with 15 additions and 1 deletions

View File

@ -261,7 +261,21 @@ Screen.prototype.__defineSetter__('terminal', function(terminal) {
});
Screen.prototype.setTerminal = function(terminal) {
return this.program.setTerminal(terminal);
var entered = !!this.program.isAlt
, result;
if (entered) {
this.program._buf = '';
this.leave();
}
result = this.program.setTerminal(terminal);
if (entered) {
this.enter();
}
return result;
};
Screen.prototype.enter = function() {