neo-blessed/test/widget-scrollable-boxes.js

124 lines
1.7 KiB
JavaScript
Raw Normal View History

2013-07-19 01:57:17 -05:00
var blessed = require('../')
, screen;
2013-07-19 01:57:17 -05:00
screen = blessed.screen({
dump: __dirname + '/scrollable-boxes.log',
smartCSR: true
});
var box = blessed.box({
2013-07-19 01:57:17 -05:00
parent: screen,
scrollable: true,
2013-07-19 01:57:17 -05:00
left: 'center',
top: 'center',
width: '80%',
height: '80%',
bg: 'green',
border: {
type: 'ascii'
},
content: 'foobar',
keys: true,
vi: true,
alwaysScroll: true,
scrollbar_: {
2013-07-19 01:57:17 -05:00
ch: ' ',
inverse: true
}
});
var text = blessed.box({
parent: box,
content: 'hello1\nhello2\nhello3\nhello4',
2013-07-19 01:57:17 -05:00
style: {
bg: 'red'
},
left: 2,
top: 30,
width: '50%',
height: 6
2013-07-19 01:57:17 -05:00
});
var text2 = blessed.box({
parent: box,
content: 'world',
style: {
bg: 'red'
},
left: 2,
top: 50,
width: '50%',
height: 3
});
var box2 = blessed.box({
parent: box,
scrollable: true,
2013-07-25 18:09:00 -05:00
content: 'foo-one\nfoo-two',
left: 'center',
top: 20,
width: '80%',
2013-07-25 18:09:00 -05:00
height: 9,
2013-07-26 00:19:57 -05:00
border_: {
2013-07-25 18:09:00 -05:00
type: 'ascii'
},
style: {
bg: 'magenta',
focus: {
bg: 'blue'
},
hover: {
bg: 'red'
}
},
keys: true,
vi: true,
alwaysScroll: true,
scrollbar_: {
ch: ' ',
inverse: true
}
});
var box3 = blessed.box({
parent: box2,
//scrollable: true,
//content: 'foo1\nfoo2\nfoo3\nfoo4\nfoo5\nfoo6\nfoo7\nf008',
//left: 'center',
left: 2,
top: 2,
content: 'foo',
shrink: true,
2013-07-26 00:19:57 -05:00
//height: 2,
//width: 3,
2013-07-25 18:09:00 -05:00
//width: '80%',
//height: 5,
2013-07-26 00:19:57 -05:00
border_: {
type: 'ascii'
},
style: {
bg: 'yellow',
focus: {
bg: 'blue'
},
hover: {
bg: 'red'
}
},
keys: true,
vi: true,
alwaysScroll: true,
scrollbar_: {
ch: ' ',
inverse: true
}
});
2013-07-19 01:57:17 -05:00
screen.key('q', function() {
return process.exit(0);
});
box.focus();
screen.render();