diff --git a/lib/widget.js b/lib/widget.js index 668479d..c769524 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -677,7 +677,7 @@ Screen.prototype.cleanSides = function(el) { return pos._cleanSides = true; } - for (; y < yl; y++) { + for (y = yi; y < yl; y++) { for (x = pos.xi - 1; x >= 0; x--) { ch = this.olines[y][x]; if (ch[0] !== first[0] || ch[1] !== first[1]) { @@ -686,7 +686,7 @@ Screen.prototype.cleanSides = function(el) { } } - for (; y < yl; y++) { + for (y = yi; y < yl; y++) { for (x = pos.xl; x < this.width; x++) { ch = this.olines[y][x]; if (ch[0] !== first[0] || ch[1] !== first[1]) { @@ -2007,8 +2007,7 @@ outer: Box.prototype.insertLine = function(i, line) { //if (typeof line === 'string') line = [line]; - // if (this.screen.cleanSides(this)) { - if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) { + if (this.screen.cleanSides(this)) { i = Math.max(i, 0); i = Math.min(i, this._lastPos.yl - this._lastPos.yi - (this.border ? 2 : 0) - this.padding * 2); //this.screen.insertLine(line.length @@ -2028,8 +2027,7 @@ Box.prototype.insertLine = function(i, line) { Box.prototype.deleteLine = function(i) { //if (typeof line === 'string') line = [line]; var reset = true; - // if (this.screen.cleanSides(this)) { - if (this._lastPos && this._lastPos.xi === 0 && this._lastPos.xl === this.screen.width) { + if (this.screen.cleanSides(this)) { i = Math.max(i, 0); i = Math.min(i, this._lastPos.yl - this._lastPos.yi - (this.border ? 2 : 0) - this.padding * 2); //this.screen.deleteLine(line.length, @@ -2205,8 +2203,7 @@ ScrollableBox.prototype.scroll = function(offset) { // Optimize scrolling with CSR + IL/DL. p = this._lastPos; - // if (this.childBase !== base && this.screen.cleanSides(this)) { - if (this.childBase !== base && p && (p.xl - p.xi) === this.screen.width) { + if (this.childBase !== base && this.screen.cleanSides(this)) { t = p.yi + (this.border ? 1 : 0) + this.padding; b = p.yl - (this.border ? 1 : 0) - this.padding - 1; d = this.childBase - base;