Merge pull request #12 from johnspackman/element-bg-char

Added a background fill character to Element
This commit is contained in:
Christopher Jeffrey 2013-08-12 06:50:19 -07:00
commit 4b6cf96030
1 changed files with 6 additions and 4 deletions

View File

@ -1767,6 +1767,7 @@ function Element(options) {
this.wrap = options.wrap !== false;
this.shrink = options.shrink;
this.fixed = options.fixed;
this.bgChar = options.bgChar || ' ';
if (typeof options.padding === 'number' || !options.padding) {
options.padding = {
@ -2998,7 +2999,8 @@ Element.prototype.render = function() {
, c
, rtop
, visible
, i;
, i
, bgChar = this.bgChar;
if (coords.base >= this._clines.ci.length) {
ci = this._pcontent.length;
@ -3051,7 +3053,7 @@ Element.prototype.render = function() {
cell = lines[y][x];
if (!cell) break;
ch = content[ci++] || ' ';
ch = content[ci++] || bgChar;
// Handle escape codes.
while (ch === '\x1b') {
@ -3063,7 +3065,7 @@ Element.prototype.render = function() {
&& this.parent.items[this.parent.selected] === this) {
attr = (attr & ~(0x1ff << 9)) | (dattr & (0x1ff << 9));
}
ch = content[ci] || ' ';
ch = content[ci] || bgChar;
ci++;
} else {
break;
@ -3082,7 +3084,7 @@ Element.prototype.render = function() {
}
// We could use fillRegion here, name the
// outer loop, and continue to it instead.
ch = ' ';
ch = bgChar;
for (; x < xl; x++) {
cell = lines[y][x];
if (!cell) break;