fix: separator tag.

This commit is contained in:
Christopher Jeffrey 2014-06-26 12:46:41 -05:00
parent e03eb16e6b
commit 23bba3f41e
2 changed files with 7 additions and 5 deletions

View File

@ -2148,7 +2148,8 @@ Element.prototype._parseAttr = function(lines) {
Element.prototype._align = function(line, width, align) {
if (!align) return line;
var len = line.replace(/\x1b\[[\d;]*m/g, '').length
var cline = line.replace(/\x1b\[[\d;]*m/g, '')
, len = cline.length
, s = width - len;
if (len === 0) return line;
@ -2162,7 +2163,8 @@ Element.prototype._align = function(line, width, align) {
return s + line;
} else if (this.parseTags && ~line.indexOf('{|}')) {
var parts = line.split('{|}');
s = Math.max(width - parts[0].length - parts[1].length, 0);
var cparts = cline.split('{|}');
s = Math.max(width - cparts[0].length - cparts[1].length, 0);
s = Array(s + 1).join(' ');
return parts[0] + s + parts[1];
}

View File

@ -13,14 +13,14 @@ var box = blessed.box({
left: 0,
width: 12,
tags: true,
content: 'line{|}1',
content: '{yellow-fg}line{/yellow-fg}{|}1',
//valign: 'middle'
});
screen.render();
box.insertBottom('line{|}2');
box.insertTop('line{|}0');
box.insertBottom('{yellow-fg}line{/yellow-fg}{|}2');
box.insertTop('{yellow-fg}line{/yellow-fg}{|}0');
screen.render();