misc. docs.

This commit is contained in:
Christopher Jeffrey 2013-07-15 18:53:04 -05:00
parent 12e7eab68d
commit 87dc701b46
2 changed files with 28 additions and 15 deletions

View File

@ -158,9 +158,11 @@ The screen on which every other node renders.
- **keypress** - received on key events.
- **element [name]** - global events received for all elements.
- **key [name]** - received on key event for [name].
- **focus, blur** - when the terminal window focuses/blurs. requires a terminal
supporting the focus protocol and focus needs to be passed to
- **focus, blur** - received when the terminal window focuses/blurs. requires a
terminal supporting the focus protocol and focus needs to be passed to
program.enableMouse().
- **prerender** - received before render.
- **render** - received on render.
##### Methods:

View File

@ -311,11 +311,16 @@ function Screen(options) {
this.program.alternateBuffer();
this.program.hideCursor();
this.program.cup(0, 0);
//this.program.csr(0, this.height - 1);
this.alloc();
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();
@ -554,6 +559,9 @@ Screen.prototype.alloc = function() {
Screen.prototype.render = function() {
var self = this;
this.emit('prerender');
// TODO: Could possibly drop .dirty and just clear the `lines` buffer every
// time before a screen.render. This way clearRegion doesn't have to be
// called in arbitrary places for the sake of clearing a spot where an
@ -566,8 +574,10 @@ Screen.prototype.render = function() {
el.render();
});
this._ci = -1;
this.draw(0, this.rows - 1);
this.emit('draw');
this.emit('render');
};
Screen.prototype.blankLine = function(ch, dirty) {
@ -585,17 +595,17 @@ Screen.prototype.insertLine = function(n, y, top, bottom) {
|| !this.tput.strings.delete_line
|| !this.tput.strings.insert_line) return;
if (n < 1) n = 1;
this.program.saveCursor();
this.program.sc();
this.program.csr(top, bottom);
this.program.cup(y, 0);
//if (y === top && n === 1) {
// this.program.ri(); // su
//} else {
this.program.il(n);
this.program.csr(0, this.height - 1);
this.program.restoreCursor();
this.program.rc();
var j = this.rows - 1 - bottom;
j = this.rows - 1 - j + 1;
var j = bottom + 1;
while (n--) {
this.lines.splice(y, 0, this.blankLine());
@ -611,17 +621,18 @@ Screen.prototype.deleteLine = function(n, y, top, bottom) {
|| !this.tput.strings.delete_line
|| !this.tput.strings.insert_line) return;
if (n < 1) n = 1;
this.program.saveCursor();
this.program.sc();
this.program.csr(top, bottom);
//if (y === top && n === 1) {
// this.program.cup(bottom, 0);
// this.program.ind(); // sd
//} else {
this.program.cup(y, 0);
this.program.dl(n);
this.program.csr(0, this.height - 1);
this.program.restoreCursor();
this.program.rc();
var j = this.rows - 1 - bottom;
j = this.rows - 1 - j + 1;
var j = bottom + 1;
while (n--) {
this.lines.splice(j, 0, this.blankLine());