2013-07-19 06:57:17 +00:00
|
|
|
var blessed = require('../')
|
2013-07-25 06:20:47 +00:00
|
|
|
, screen;
|
2013-07-19 06:57:17 +00:00
|
|
|
|
2013-07-25 06:20:47 +00:00
|
|
|
screen = blessed.screen({
|
2013-07-28 19:29:07 +00:00
|
|
|
dump: __dirname + '/logs/scrollable-boxes.log',
|
2013-07-25 06:20:47 +00:00
|
|
|
smartCSR: true
|
|
|
|
});
|
|
|
|
|
|
|
|
var box = blessed.box({
|
2013-07-19 06:57:17 +00:00
|
|
|
parent: screen,
|
2013-08-01 12:09:06 +00:00
|
|
|
//padding: 2,
|
2013-07-25 06:20:47 +00:00
|
|
|
scrollable: true,
|
2013-07-19 06:57:17 +00:00
|
|
|
left: 'center',
|
|
|
|
top: 'center',
|
|
|
|
width: '80%',
|
|
|
|
height: '80%',
|
2015-04-04 06:43:24 +00:00
|
|
|
style: {
|
|
|
|
bg: 'green'
|
2013-07-19 06:57:17 +00:00
|
|
|
},
|
2015-04-04 06:43:24 +00:00
|
|
|
border: 'line',
|
2013-07-19 06:57:17 +00:00
|
|
|
content: 'foobar',
|
|
|
|
keys: true,
|
|
|
|
vi: true,
|
|
|
|
alwaysScroll: true,
|
2013-08-01 12:09:06 +00:00
|
|
|
scrollbar: {
|
2013-07-19 06:57:17 +00:00
|
|
|
ch: ' ',
|
|
|
|
inverse: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var text = blessed.box({
|
|
|
|
parent: box,
|
2013-07-25 02:21:20 +00:00
|
|
|
content: 'hello1\nhello2\nhello3\nhello4',
|
2013-08-01 12:09:06 +00:00
|
|
|
padding: 2,
|
2013-07-19 06:57:17 +00:00
|
|
|
style: {
|
|
|
|
bg: 'red'
|
|
|
|
},
|
|
|
|
left: 2,
|
|
|
|
top: 30,
|
|
|
|
width: '50%',
|
2013-07-25 02:21:20 +00:00
|
|
|
height: 6
|
2013-07-19 06:57:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var text2 = blessed.box({
|
|
|
|
parent: box,
|
|
|
|
content: 'world',
|
2013-08-01 12:09:06 +00:00
|
|
|
padding: 1,
|
2013-07-19 06:57:17 +00:00
|
|
|
style: {
|
|
|
|
bg: 'red'
|
|
|
|
},
|
|
|
|
left: 2,
|
|
|
|
top: 50,
|
|
|
|
width: '50%',
|
|
|
|
height: 3
|
|
|
|
});
|
|
|
|
|
2013-07-25 06:20:47 +00:00
|
|
|
var box2 = blessed.box({
|
|
|
|
parent: box,
|
|
|
|
scrollable: true,
|
2013-07-27 10:14:02 +00:00
|
|
|
content: 'foo-one\nfoo-two\nfoo-three',
|
2013-08-01 12:09:06 +00:00
|
|
|
padding: 2,
|
2013-07-25 06:20:47 +00:00
|
|
|
left: 'center',
|
|
|
|
top: 20,
|
|
|
|
width: '80%',
|
2013-07-25 23:09:00 +00:00
|
|
|
height: 9,
|
2015-04-04 06:43:24 +00:00
|
|
|
border: 'line',
|
2013-07-25 23:09:00 +00:00
|
|
|
style: {
|
|
|
|
bg: 'magenta',
|
|
|
|
focus: {
|
|
|
|
bg: 'blue'
|
|
|
|
},
|
|
|
|
hover: {
|
|
|
|
bg: 'red'
|
|
|
|
}
|
2015-04-04 06:43:24 +00:00
|
|
|
// scrollbar: {
|
|
|
|
// inverse: true
|
|
|
|
// }
|
2013-07-25 23:09:00 +00:00
|
|
|
},
|
|
|
|
keys: true,
|
|
|
|
vi: true,
|
2015-04-04 06:43:24 +00:00
|
|
|
alwaysScroll: true
|
|
|
|
// scrollbar: {
|
|
|
|
// ch: ' '
|
|
|
|
// }
|
2013-07-25 23:09:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var box3 = blessed.box({
|
|
|
|
parent: box2,
|
2013-07-26 06:45:39 +00:00
|
|
|
scrollable: true,
|
2013-07-25 23:09:00 +00:00
|
|
|
//content: 'foo1\nfoo2\nfoo3\nfoo4\nfoo5\nfoo6\nfoo7\nf008',
|
|
|
|
//left: 'center',
|
2013-07-26 06:45:39 +00:00
|
|
|
left: 3,
|
|
|
|
top: 3,
|
2013-07-25 23:09:00 +00:00
|
|
|
content: 'foo',
|
2013-07-26 06:45:39 +00:00
|
|
|
//shrink: true,
|
|
|
|
height: 4,
|
|
|
|
width: 5,
|
2013-07-25 23:09:00 +00:00
|
|
|
//width: '80%',
|
|
|
|
//height: 5,
|
2015-04-04 06:43:24 +00:00
|
|
|
border: 'line',
|
2013-07-25 06:20:47 +00:00
|
|
|
style: {
|
|
|
|
bg: 'yellow',
|
|
|
|
focus: {
|
|
|
|
bg: 'blue'
|
|
|
|
},
|
|
|
|
hover: {
|
|
|
|
bg: 'red'
|
|
|
|
}
|
2015-04-04 06:43:24 +00:00
|
|
|
// scrollbar: {
|
|
|
|
// inverse: true
|
|
|
|
// }
|
2013-07-25 06:20:47 +00:00
|
|
|
},
|
|
|
|
keys: true,
|
|
|
|
vi: true,
|
2015-04-04 06:43:24 +00:00
|
|
|
alwaysScroll: true
|
|
|
|
// scrollbar: {
|
|
|
|
// ch: ' '
|
|
|
|
// }
|
2013-07-25 06:20:47 +00:00
|
|
|
});
|
|
|
|
|
2013-07-19 06:57:17 +00:00
|
|
|
screen.key('q', function() {
|
|
|
|
return process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
box.focus();
|
|
|
|
|
|
|
|
screen.render();
|