mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-09 18:45:51 +00:00
automatically use alternate buffer etc.
This commit is contained in:
parent
2cbbe786fb
commit
812aa7fa42
@ -142,6 +142,10 @@ function Screen(options) {
|
|||||||
bottom: this.bottom = 0
|
bottom: this.bottom = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.focused = null;
|
||||||
|
this.clickable = [];
|
||||||
|
this.input = [];
|
||||||
|
|
||||||
this.alloc();
|
this.alloc();
|
||||||
|
|
||||||
this.program.on('resize', function() {
|
this.program.on('resize', function() {
|
||||||
@ -150,9 +154,14 @@ function Screen(options) {
|
|||||||
self.emit('resize');
|
self.emit('resize');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.focused = null;
|
this.program.alternateBuffer();
|
||||||
this.clickable = [];
|
this.program.hideCursor();
|
||||||
this.input = [];
|
|
||||||
|
process.on('exit', function() {
|
||||||
|
self.program.clear();
|
||||||
|
self.program.showCursor();
|
||||||
|
self.program.normalBuffer();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen._default = null;
|
Screen._default = null;
|
||||||
@ -282,7 +291,6 @@ Screen.prototype.draw = function(start, end) {
|
|||||||
, o;
|
, o;
|
||||||
|
|
||||||
this.program.saveCursor();
|
this.program.saveCursor();
|
||||||
//this.program.write('\x1b[1;1H');
|
|
||||||
|
|
||||||
for (y = start; y <= end; y++) {
|
for (y = start; y <= end; y++) {
|
||||||
line = this.lines[y];
|
line = this.lines[y];
|
||||||
@ -1190,7 +1198,7 @@ ScrollableText.prototype.scroll = function(offset) {
|
|||||||
// and put it in a scrollable text box.
|
// and put it in a scrollable text box.
|
||||||
if (this.content != null) {
|
if (this.content != null) {
|
||||||
var cb = this.childBase
|
var cb = this.childBase
|
||||||
, data = this.render(true)
|
, data = this.render(true) || 0
|
||||||
, xi = data.xi
|
, xi = data.xi
|
||||||
, xl = data.xl
|
, xl = data.xl
|
||||||
, xxl = xl - (this.border ? 1 : 0)
|
, xxl = xl - (this.border ? 1 : 0)
|
||||||
@ -1199,6 +1207,9 @@ ScrollableText.prototype.scroll = function(offset) {
|
|||||||
, xxxi
|
, xxxi
|
||||||
, cci;
|
, cci;
|
||||||
|
|
||||||
|
// XXX Temporary workaround for .render() not working while hidden.
|
||||||
|
if (!data) return ret;
|
||||||
|
|
||||||
if (this.contentIndex != null) {
|
if (this.contentIndex != null) {
|
||||||
ci = this.contentIndex;
|
ci = this.contentIndex;
|
||||||
cb = diff;
|
cb = diff;
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
var blessed = require('blessed')
|
var blessed = require('blessed')
|
||||||
, program = blessed()
|
, program = blessed();
|
||||||
, screen;
|
|
||||||
|
|
||||||
program.alternateBuffer();
|
var screen = new blessed.Screen({
|
||||||
program.hideCursor();
|
|
||||||
|
|
||||||
screen = new blessed.Screen({
|
|
||||||
program: program
|
program: program
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -186,10 +182,6 @@ program.on('keypress', function(ch, key) {
|
|||||||
: screen.focusNext();
|
: screen.focusNext();
|
||||||
}
|
}
|
||||||
if (key.name === 'escape' || key.name === 'q') {
|
if (key.name === 'escape' || key.name === 'q') {
|
||||||
program.disableMouse();
|
|
||||||
program.clear();
|
|
||||||
program.showCursor();
|
|
||||||
program.normalBuffer();
|
|
||||||
return process.exit(0);
|
return process.exit(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -199,8 +191,8 @@ list.focus();
|
|||||||
screen.render();
|
screen.render();
|
||||||
|
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
//stext.toggle();
|
stext.toggle();
|
||||||
//screen.render();
|
screen.render();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
(function fill() {
|
(function fill() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user