Added a background fill character to Element

This is used to fill the background of the element, EG for text area I
typically set this to '_' to show the extent of the field
This commit is contained in:
John Spackman 2013-08-12 14:12:18 +01:00
parent 7f23ade08b
commit ffd98d0f8e
1 changed files with 6 additions and 4 deletions

View File

@ -1756,6 +1756,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 = {
@ -2987,7 +2988,8 @@ Element.prototype.render = function() {
, c
, rtop
, visible
, i;
, i
, bgChar = this.bgChar;
if (coords.base >= this._clines.ci.length) {
ci = this._pcontent.length;
@ -3040,7 +3042,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') {
@ -3052,7 +3054,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;
@ -3071,7 +3073,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;