Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the ch atribute elements always being set to ' ', regardless of input. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions lib/widgets/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ function Element(options) {
bottom: options.padding.bottom || 0
};

this.border = options.border;
this.border = options.border || options.style.border;
if (this.border) {
if (typeof this.border === 'string') {
this.border = { type: this.border };
}
this.border.type = this.border.type || 'bg';
if (this.border.type === 'ascii') this.border.type = 'line';
this.border.ch = this.border.ch || ' ';
this.border.ch = this.border.ch || this.style.border.ch || ' ';
if (this.border.ch.length > 1) this.border.ch = this.border.ch.charAt(0)
this.style.border = this.style.border || this.border.style;
if (!this.style.border) {
this.style.border = {};
Expand Down Expand Up @@ -1873,7 +1874,6 @@ Element.prototype.render = function() {
, visible
, i
, bch = this.ch;

// Clip content if it's off the edge of the screen
// if (xi + this.ileft < 0 || yi + this.itop < 0) {
// var clines = this._clines.slice();
Expand Down Expand Up @@ -2134,6 +2134,7 @@ Element.prototype.render = function() {

// Draw the border.
if (this.border) {
ch = bch
battr = this.sattr(this.style.border);
y = yi;
if (coords.notop) y = -1;
Expand Down Expand Up @@ -2177,7 +2178,6 @@ Element.prototype.render = function() {
ch = this.border.ch;
}
if (!this.border.top && x !== xi && x !== xl - 1) {
ch = ' ';
if (dattr !== cell[0] || ch !== cell[1]) {
lines[y][x][0] = dattr;
lines[y][x][1] = ch;
Expand Down Expand Up @@ -2209,7 +2209,6 @@ Element.prototype.render = function() {
lines[y].dirty = true;
}
} else {
ch = ' ';
if (dattr !== cell[0] || ch !== cell[1]) {
lines[y][xi][0] = dattr;
lines[y][xi][1] = ch;
Expand All @@ -2232,7 +2231,6 @@ Element.prototype.render = function() {
lines[y].dirty = true;
}
} else {
ch = ' ';
if (dattr !== cell[0] || ch !== cell[1]) {
lines[y][xl - 1][0] = dattr;
lines[y][xl - 1][1] = ch;
Expand Down Expand Up @@ -2283,7 +2281,6 @@ Element.prototype.render = function() {
ch = this.border.ch;
}
if (!this.border.bottom && x !== xi && x !== xl - 1) {
ch = ' ';
if (dattr !== cell[0] || ch !== cell[1]) {
lines[y][x][0] = dattr;
lines[y][x][1] = ch;
Expand Down Expand Up @@ -2568,4 +2565,4 @@ Element.prototype.screenshot = function(xi, xl, yi, yl) {
* Expose
*/

module.exports = Element;
module.exports = Element;