fix image rendering.

This commit is contained in:
Christopher Jeffrey 2015-02-09 00:19:35 -08:00
parent cce38f9f21
commit 9e234c3901
2 changed files with 11 additions and 3 deletions

View File

@ -6583,7 +6583,7 @@ Image.w3mdisplay = '/usr/lib/w3m/w3mimgdisplay';
Image.prototype.render = function() { Image.prototype.render = function() {
var ret = this._render(); var ret = this._render();
if (!ret) return; if (!ret) return;
this.setImage(this.options.file); this.setImage(this.img);
return ret; return ret;
}; };

View File

@ -6,16 +6,24 @@ screen = blessed.screen({
smartCSR: true smartCSR: true
}); });
blessed.image.w3mdisplay = '/does/not/exist';
var file = process.argv[2] || __dirname + '/test-image.png';
var img = blessed.image({ var img = blessed.image({
parent: screen, parent: screen,
left: 'center', left: 'center',
top: 'center', top: 'center',
width: 'shrink', width: 'shrink',
height: 'shrink', height: 'shrink',
bg: 'green', bg: 'green'
file: process.argv[2] || __dirname + '/test-image.png'
}); });
setTimeout(function() {
img.setImage(file);
screen.render();
}, 1000);
img.focus(); img.focus();
screen.key('i', function() { screen.key('i', function() {