screenshot coords.

This commit is contained in:
Christopher Jeffrey 2015-04-21 05:03:46 -07:00
parent 7c49f67247
commit 9a75c29281

View File

@ -228,17 +228,33 @@ function cp437ToUtf8(buf, callback) {
blessed.Element.prototype.screenshot = function(xi, xl, yi, yl) {
xi = this.lpos.xi + this.ileft + (xi || 0);
xl = this.lpos.xl - this.iright + (xl || 0);
if (xl != null) {
xl = this.lpos.xi + this.ileft + (xl || 0);
} else {
xl = this.lpos.xl - this.iright;
}
yi = this.lpos.yi + this.itop + (yi || 0);
yl = this.lpos.yl - this.ibottom + (yl || 0);
if (yl != null) {
yl = this.lpos.yi + this.itop + (yl || 0);
} else {
yl = this.lpos.yl - this.ibottom;
}
return this.screen.screenshot(xi, xl, yi, yl);
};
blessed.Terminal.prototype.screenshot = function(xi, xl, yi, yl) {
xi = 0 + (xi || 0);
xl = this.term.lines[0].length + (xl || 0);
if (xl != null) {
xl = 0 + (xl || 0);
} else {
xl = this.term.lines[0].length;
}
yi = 0 + (yi || 0);
yl = this.term.lines.length + (yl || 0);
if (yl != null) {
yl = 0 + (yl || 0);
} else {
yl = this.term.lines.length;
}
return this.screen.screenshot(xi, xl, yi, yl, this.term);
};