handle animating screenshots. ansi-viewer.

This commit is contained in:
Christopher Jeffrey 2015-04-21 06:56:40 -07:00
parent 5f1d320112
commit 43c39b525f
1 changed files with 18 additions and 4 deletions

View File

@ -25,6 +25,16 @@ var max = Object.keys(map).reduce(function(out, text) {
return Math.max(out, text.length);
}, 0) + 6;
// Animating ANSI art doesn't work for screenshots.
var ANIMATING = [
'bbs/void3',
'holiday/xmasfwks',
'unsorted/diver',
'unsorted/mash-chp',
'unsorted/ryans47',
'unsorted/xmasfwks'
];
var screen = blessed.screen({
smartCSR: true,
dockBorders: true
@ -190,10 +200,14 @@ list.on('select', function(el, selected) {
screen.render();
if (process.argv[2] === '--debug' || process.argv[2] === '--save') {
//var sgr = blessed.element.prototype.screenshot.call(art,
// 0 - art.ileft, art.width - art.iright,
// 0 - art.itop, art.height - art.ibottom);
// Animating art hangs terminal during screenshot as of right now.
if (~ANIMATING.indexOf(name)) {
var sgr = blessed.element.prototype.screenshot.call(art,
0 - art.ileft, art.width - art.iright,
0 - art.itop, art.height - art.ibottom);
} else {
var sgr = art.screenshot();
}
fs.writeFileSync(__dirname + '/' + filename + '.sgr', sgr);
}
});