more scroll fixing.

This commit is contained in:
Christopher Jeffrey 2013-06-18 05:44:36 -05:00
parent 3d52833fa3
commit 787c7c6945

View File

@ -1674,9 +1674,6 @@ ScrollableText.prototype.scroll = function(offset) {
// When scrolling text, we want to be able to handle SGR codes as well as line
// feeds. This allows us to take preformatted text output from other programs
// and put it in a scrollable text box.
// TODO: Move this into a separate function and call it from the constructor
// and setContent.
// TODO: Possibly map _clines into line lengths only to save memory.
if (this.content != null) {
w = this.width - (this.border ? 2 : 0);
if (this._clines == null || this._clines.width !== w) {
@ -1714,8 +1711,11 @@ ScrollableText.prototype._recalculateIndex = function() {
this._clines = wrapContent(this.content, this.width - (this.border ? 2 : 0));
this._pcontent = this._clines.join('\n');
if (this.childBase > this._clines.length - 1) {
this.childBase = this._clines.length - 1;
var max = this._clines.length - 1 - (this.height - (this.border ? 2 : 0));
if (max < 0) max = 0;
if (this.childBase > max) {
this.childBase = max;
}
for (var i = 0, t = 0; i < this.childBase; i++) {