mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-11 03:25:45 +00:00
misc. docs.
This commit is contained in:
parent
12e7eab68d
commit
87dc701b46
@ -158,9 +158,11 @@ The screen on which every other node renders.
|
|||||||
- **keypress** - received on key events.
|
- **keypress** - received on key events.
|
||||||
- **element [name]** - global events received for all elements.
|
- **element [name]** - global events received for all elements.
|
||||||
- **key [name]** - received on key event for [name].
|
- **key [name]** - received on key event for [name].
|
||||||
- **focus, blur** - when the terminal window focuses/blurs. requires a terminal
|
- **focus, blur** - received when the terminal window focuses/blurs. requires a
|
||||||
supporting the focus protocol and focus needs to be passed to
|
terminal supporting the focus protocol and focus needs to be passed to
|
||||||
program.enableMouse().
|
program.enableMouse().
|
||||||
|
- **prerender** - received before render.
|
||||||
|
- **render** - received on render.
|
||||||
|
|
||||||
##### Methods:
|
##### Methods:
|
||||||
|
|
||||||
|
@ -311,11 +311,16 @@ function Screen(options) {
|
|||||||
this.program.alternateBuffer();
|
this.program.alternateBuffer();
|
||||||
this.program.hideCursor();
|
this.program.hideCursor();
|
||||||
this.program.cup(0, 0);
|
this.program.cup(0, 0);
|
||||||
|
//this.program.csr(0, this.height - 1);
|
||||||
this.alloc();
|
this.alloc();
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
if (reset.done) return;
|
if (reset.done) return;
|
||||||
reset.done = true;
|
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.clear();
|
||||||
self.program.showCursor();
|
self.program.showCursor();
|
||||||
self.program.normalBuffer();
|
self.program.normalBuffer();
|
||||||
@ -554,6 +559,9 @@ Screen.prototype.alloc = function() {
|
|||||||
|
|
||||||
Screen.prototype.render = function() {
|
Screen.prototype.render = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
this.emit('prerender');
|
||||||
|
|
||||||
// TODO: Could possibly drop .dirty and just clear the `lines` buffer every
|
// 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
|
// 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
|
// called in arbitrary places for the sake of clearing a spot where an
|
||||||
@ -566,8 +574,10 @@ Screen.prototype.render = function() {
|
|||||||
el.render();
|
el.render();
|
||||||
});
|
});
|
||||||
this._ci = -1;
|
this._ci = -1;
|
||||||
|
|
||||||
this.draw(0, this.rows - 1);
|
this.draw(0, this.rows - 1);
|
||||||
this.emit('draw');
|
|
||||||
|
this.emit('render');
|
||||||
};
|
};
|
||||||
|
|
||||||
Screen.prototype.blankLine = function(ch, dirty) {
|
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.delete_line
|
||||||
|| !this.tput.strings.insert_line) return;
|
|| !this.tput.strings.insert_line) return;
|
||||||
|
|
||||||
if (n < 1) n = 1;
|
this.program.sc();
|
||||||
|
|
||||||
this.program.saveCursor();
|
|
||||||
this.program.csr(top, bottom);
|
this.program.csr(top, bottom);
|
||||||
this.program.cup(y, 0);
|
this.program.cup(y, 0);
|
||||||
|
//if (y === top && n === 1) {
|
||||||
|
// this.program.ri(); // su
|
||||||
|
//} else {
|
||||||
this.program.il(n);
|
this.program.il(n);
|
||||||
this.program.csr(0, this.height - 1);
|
this.program.csr(0, this.height - 1);
|
||||||
this.program.restoreCursor();
|
this.program.rc();
|
||||||
|
|
||||||
var j = this.rows - 1 - bottom;
|
var j = bottom + 1;
|
||||||
j = this.rows - 1 - j + 1;
|
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
this.lines.splice(y, 0, this.blankLine());
|
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.delete_line
|
||||||
|| !this.tput.strings.insert_line) return;
|
|| !this.tput.strings.insert_line) return;
|
||||||
|
|
||||||
if (n < 1) n = 1;
|
this.program.sc();
|
||||||
|
|
||||||
this.program.saveCursor();
|
|
||||||
this.program.csr(top, bottom);
|
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.cup(y, 0);
|
||||||
this.program.dl(n);
|
this.program.dl(n);
|
||||||
this.program.csr(0, this.height - 1);
|
this.program.csr(0, this.height - 1);
|
||||||
this.program.restoreCursor();
|
this.program.rc();
|
||||||
|
|
||||||
var j = this.rows - 1 - bottom;
|
var j = bottom + 1;
|
||||||
j = this.rows - 1 - j + 1;
|
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
this.lines.splice(j, 0, this.blankLine());
|
this.lines.splice(j, 0, this.blankLine());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user