drop old insert/delete line methods.

This commit is contained in:
Christopher Jeffrey 2013-07-12 03:54:01 -05:00
parent 933b5442bd
commit b92c0b7758

View File

@ -1835,45 +1835,6 @@ outer:
// Things will break because we're using _lastPos instead of render(true).
// Maybe _lastPos could be updated on .left, .right, etc setters?
// OLD
Box.prototype.insertTop = function(line) {
if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) {
this.screen.insertTop(this._lastPos.yi, this._lastPos.yl - 1);
}
this._clines.splice((this.childBase || 0) + (this.border ? 1 : 0), 0, line);
this.setContent(this._clines.join('\n'), true);
};
Box.prototype.insertBottom = function(line) {
if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) {
this.screen.insertBottom(this._lastPos.yi, this._lastPos.yl - 1);
}
this._clines.splice((this.childBase || 0) + this.height - (this.border ? 2 : 0), 0, line);
this.setContent(this._clines.join('\n'), true);
};
Box.prototype.deleteTop = function() {
var reset = true;
if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) {
this.screen.deleteTop(this._lastPos.yi, this._lastPos.yl - 1);
reset = false;
}
this._clines.splice((this.childBase || 0) + (this.border ? 1 : 0), 1);
this.setContent(this._clines.join('\n'), reset);
};
Box.prototype.deleteBottom = function() {
var reset = true;
if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) {
this.screen.deleteBottom(this._lastPos.yi, this._lastPos.yl - 1);
reset = false;
}
this._clines.splice((this.childBase || 0) + this.height - (this.border ? 2 : 0), 1);
this.setContent(this._clines.join('\n'), reset);
};
// NEW
Box.prototype.insertLine = function(i, line) {
//if (typeof line === 'string') line = [line];
if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) {
@ -1909,7 +1870,7 @@ Box.prototype.deleteLine = function(i) {
this._clines.splice((this.childBase || 0) + (this.border ? 1 : 0) + i, 1);
// OR:
//line.forEach(function(line, j) {
// this._clines.splice((this.childBase || 0) + (this.border ? 1 : 0) + i + j, 1);
// this._clines.splice((this.childBase || 0) + (this.border ? 1 : 0) + i, 1);
//}, this);
this.setContent(this._clines.join('\n'), reset);
};