Skip to content
Snippets Groups Projects
Commit bbfaecc9 authored by echicken's avatar echicken
Browse files

Added Frame.dump, Display.dump, because everybody needs to take a dump now

and then.

Frame.dump returns a 2D array of [row[[column]]] data representing what is
visible in the terminal at the moment.  If a given y,x location has no
data, [y][x] is left undefined. If more than one frame has data at a given
location, the topmost frame's data is returned. Data from frames beneath
non-transparent frames will not be returned.
parent c78f086e
Branches
Tags
No related merge requests found
......@@ -887,6 +887,9 @@ Frame.prototype.invalidate = function() {
this.__properties__.display.invalidate();
this.refresh();
}
Frame.prototype.dump = function() {
return this.__properties__.display.dump();
}
/* console method emulation */
Frame.prototype.home = function() {
......@@ -1476,6 +1479,21 @@ Display.prototype.screenShot = function(file,append) {
Display.prototype.invalidate = function() {
this.__properties__.buffer = {};
}
Display.prototype.dump = function() {
var arr = [];
for(var y = 0; y < this.height; y++) {
arr[y] = [];
for(var x = 0; x < this.width; x++) {
var c = this.__getTopCanvas__(x, y);
if(typeof c == "undefined")
continue;
var d = this.__getData__(c, x, y);
if(typeof d.ch != "undefined")
arr[y][x] = d;
}
}
return arr;
}
/* private functions */
Display.prototype.__updateChar__ = function(x,y/*,data*/) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment