expose screen.enter and screen.leave. fixes #29.
This commit is contained in:
parent
d49ffa7aa4
commit
c73a6c47b9
|
@ -348,26 +348,12 @@ function Screen(options) {
|
|||
self.emit('blur');
|
||||
});
|
||||
|
||||
this.program.alternateBuffer();
|
||||
this.program.hideCursor();
|
||||
this.program.cup(0, 0);
|
||||
//this.program.csr(0, this.height - 1);
|
||||
this.alloc();
|
||||
this.enter();
|
||||
|
||||
function reset() {
|
||||
if (reset.done) return;
|
||||
reset.done = true;
|
||||
if (self.program.scrollTop !== 0
|
||||
|| self.program.scrollBottom !== self.rows - 1) {
|
||||
self.program.csr(0, self.height - 1);
|
||||
}
|
||||
self.program.clear();
|
||||
self.program.showCursor();
|
||||
self.program.normalBuffer();
|
||||
if (self._listenedMouse) {
|
||||
self.program.disableMouse();
|
||||
}
|
||||
self.program.flush();
|
||||
self.leave();
|
||||
}
|
||||
|
||||
this._maxListeners = Infinity;
|
||||
|
@ -412,6 +398,31 @@ Screen.prototype.__proto__ = Node.prototype;
|
|||
|
||||
Screen.prototype.type = 'screen';
|
||||
|
||||
Screen.prototype.enter = function() {
|
||||
if (this.program.isAlt) return;
|
||||
this.program.alternateBuffer();
|
||||
this.program.hideCursor();
|
||||
this.program.cup(0, 0);
|
||||
//this.program.csr(0, this.height - 1);
|
||||
this.alloc();
|
||||
};
|
||||
|
||||
Screen.prototype.leave = function() {
|
||||
if (!this.program.isAlt) return;
|
||||
if (this.program.scrollTop !== 0
|
||||
|| this.program.scrollBottom !== this.rows - 1) {
|
||||
this.program.csr(0, this.height - 1);
|
||||
}
|
||||
// this.program.clear();
|
||||
this.alloc();
|
||||
this.program.showCursor();
|
||||
this.program.normalBuffer();
|
||||
if (this._listenedMouse) {
|
||||
this.program.disableMouse();
|
||||
}
|
||||
this.program.flush();
|
||||
};
|
||||
|
||||
Screen.prototype.log = function() {
|
||||
return this.program.log.apply(this.program, arguments);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue