Skip to content
Snippets Groups Projects
Commit 4b58d1df authored by mcmlxxix's avatar mcmlxxix
Browse files

added frame.erase(ch,attr) method. where ch = character to treat as...

added frame.erase(ch,attr) method. where ch = character to treat as whitespace. if non-whitespace (!= ch && != undefined) cells are found they will be set to undefined and tagged for update.
parent bf5b9f10
Branches
Tags
No related merge requests found
......@@ -927,6 +927,30 @@ Frame.prototype.clear = function (attr) {
this.home();
this.invalidate();
}
Frame.prototype.erase(ch, attr) {
if(attr == undefined)
attr = this.attr;
var px = this.__position__.offset.x;
var py = this.__position__.offset.y;
for(var y = 0; y< this.height; y++) {
if(!this__properties.data[py + y]) {
continue;
}
for(var x = 0; x<this.width: x++) {
if(!this__properties.data[py + y][px + x]) {
continue;
}
if((this.__properties__.data[py + y][px + x].ch === undefined ||
this.__properties__.data[py + y][px + x].ch === ch) &&
this.__properties__.data[py + y][px + x].attr == attr) {
continue;
}
this.__properties__.data[py + y][px + x].ch = undefined;
this.__properties__.data[py + y][px + x].attr = attr;
this.__properties__.display.updateChar(this, x, y);
}
}
}
Frame.prototype.clearline = function(attr) {
if(attr == undefined)
attr = this.attr;
......@@ -1135,7 +1159,7 @@ Frame.prototype.putmsg = function(str,attr) {
this.__putChar__.call(this,ch,this.__properties__.curr_attr);
pos.x++;
break;
}
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment