fix mwidth. minor.

This commit is contained in:
Christopher Jeffrey 2013-07-28 10:51:43 -05:00
parent f8fbb2a0c8
commit 927c40d2f3
1 changed files with 8 additions and 8 deletions

View File

@ -1903,6 +1903,7 @@ Element.prototype.parseContent = function() {
return true;
}
// Need to calculate this every time because the default fg/bg may change.
this._clines.attr = this._parseAttr(this._clines) || this._clines.attr;
return false;
@ -1939,10 +1940,6 @@ Element.prototype._parseAttr = function(lines) {
return;
}
if (!this.scrollable) {
//return;
}
for (j = 0; j < lines.length; j++) {
line = lines[j];
attrs[j] = attr;
@ -1989,7 +1986,6 @@ Element.prototype._wrapContent = function(content, width) {
, fake = []
, out = []
, no = 0
, mwidth = 0
, line
, align
, cap
@ -2068,7 +2064,6 @@ main:
out.push(this._align(part, width, align));
ftor[no].push(out.length - 1);
rtof.push(no);
if (part.length > mwidth) mwidth = part.length;
// Make sure we didn't wrap the line to the very end, otherwise
// we get a pointless empty line after a newline.
@ -2084,14 +2079,19 @@ main:
out.push(this._align(line, width, align));
ftor[no].push(out.length - 1);
rtof.push(no);
if (line.length > mwidth) mwidth = line.length;
}
out.rtof = rtof;
out.ftor = ftor;
out.fake = lines;
out.real = out;
out.mwidth = mwidth;
out.mwidth = out.reduce(function(current, line) {
line = line.replace(/\x1b\[[\d;]*m/g, '');
return line.length > current
? line.length
: current;
}, 0);
return out;
};