2013-07-18 22:56:05 +00:00
|
|
|
var blessed = require('../')
|
2013-07-15 06:44:11 +00:00
|
|
|
, screen;
|
|
|
|
|
|
|
|
screen = blessed.screen({
|
|
|
|
dump: __dirname + '/p.log',
|
|
|
|
smartCSR: true
|
|
|
|
});
|
2013-07-15 03:11:48 +00:00
|
|
|
|
|
|
|
var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
|
|
|
|
|
|
|
|
function expectClean(value) {
|
|
|
|
var cleanSides = screen.cleanSides;
|
|
|
|
screen.cleanSides = function() {
|
|
|
|
var ret = cleanSides.apply(this, arguments);
|
|
|
|
if (ret !== value) {
|
|
|
|
throw new Error('Failed. Expected '
|
|
|
|
+ value + ' from cleanSides. Got '
|
|
|
|
+ ret + '.');
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2013-07-15 06:44:11 +00:00
|
|
|
/*
|
2013-07-15 03:11:48 +00:00
|
|
|
blessed.box({
|
|
|
|
parent: screen,
|
|
|
|
left: 0,
|
|
|
|
top: 'center',
|
|
|
|
width: '50%',
|
|
|
|
height: 2,
|
|
|
|
bg: 'green',
|
|
|
|
content: 'This will disallow CSR.'
|
|
|
|
});
|
|
|
|
expectClean(false);
|
2013-07-15 06:44:11 +00:00
|
|
|
*/
|
2013-07-15 03:11:48 +00:00
|
|
|
|
|
|
|
blessed.box({
|
|
|
|
parent: screen,
|
|
|
|
left: 'center',
|
|
|
|
top: 'center',
|
|
|
|
width: '80%',
|
|
|
|
height: '80%',
|
|
|
|
bg: 'green',
|
|
|
|
border: {
|
|
|
|
type: 'ascii'
|
|
|
|
},
|
|
|
|
content: 'CSR should still work.'
|
|
|
|
});
|
|
|
|
expectClean(true);
|
|
|
|
|
|
|
|
var text = blessed.scrollabletext({
|
|
|
|
parent: screen,
|
|
|
|
content: lorem,
|
|
|
|
border: {
|
|
|
|
type: 'ascii'
|
|
|
|
},
|
|
|
|
left: 'center',
|
|
|
|
top: 'center',
|
|
|
|
width: '100%',
|
|
|
|
width: '50%',
|
|
|
|
height: '50%',
|
|
|
|
mouse: true,
|
|
|
|
keys: true,
|
|
|
|
vi: true
|
|
|
|
});
|
|
|
|
|
|
|
|
text.focus();
|
|
|
|
|
|
|
|
screen.key('q', function() {
|
|
|
|
return process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
screen.render();
|