mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-22 15:48:07 +00:00
scrollbar track.
This commit is contained in:
parent
80ae319225
commit
d9ca7112bc
@ -918,7 +918,7 @@ Screen.prototype.draw = function(start, end) {
|
||||
// : '\x1b[' + (xx - x) + 'C';
|
||||
// this.fillRegion(data, ' ',
|
||||
// x, this.tput && this.tput.strings.erase_chars ? xx : this.cols,
|
||||
// y, y);
|
||||
// y, y + 1);
|
||||
// x = xx - 1;
|
||||
// continue;
|
||||
// }
|
||||
@ -2842,6 +2842,7 @@ Element.prototype.render = function() {
|
||||
}
|
||||
|
||||
// Draw the scrollbar.
|
||||
// Could possibly draw this after all child elements.
|
||||
if (this.scrollbar) {
|
||||
i = Math.max(this._clines.length, this._scrollBottom());
|
||||
}
|
||||
@ -2858,6 +2859,13 @@ Element.prototype.render = function() {
|
||||
if (y >= yl) y = yl - 1;
|
||||
cell = lines[y] && lines[y][x];
|
||||
if (cell) {
|
||||
if (this.track) {
|
||||
ch = this.track.ch || ' ';
|
||||
attr = this.sattr(this.style.track,
|
||||
this.style.track.fg || this.style.fg,
|
||||
this.style.track.bg || this.style.bg);
|
||||
this.screen.fillRegion(attr, ch, x, x + 1, yi, yl);
|
||||
}
|
||||
ch = this.scrollbar.ch || ' ';
|
||||
attr = this.sattr(this.style.scrollbar,
|
||||
this.style.scrollbar.fg || this.style.fg,
|
||||
@ -3256,6 +3264,22 @@ function ScrollableBox(options) {
|
||||
this.style.scrollbar.invisible = this.scrollbar.invisible;
|
||||
}
|
||||
this.scrollbar.style = this.style.scrollbar;
|
||||
if (this.track || this.scrollbar.track) {
|
||||
this.track = this.scrollbar.track || this.track;
|
||||
this.style.track = this.style.scrollbar.track || this.style.track;
|
||||
this.track.ch = this.track.ch || ' ';
|
||||
this.style.track = this.style.track || this.track.style;
|
||||
if (!this.style.track) {
|
||||
this.style.track = {};
|
||||
this.style.track.fg = this.track.fg;
|
||||
this.style.track.bg = this.track.bg;
|
||||
this.style.track.bold = this.track.bold;
|
||||
this.style.track.underline = this.track.underline;
|
||||
this.style.track.inverse = this.track.inverse;
|
||||
this.style.track.invisible = this.track.invisible;
|
||||
}
|
||||
this.track.style = this.style.track;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.mouse) {
|
||||
|
@ -82,7 +82,12 @@ var list = blessed.list({
|
||||
],
|
||||
scrollbar: {
|
||||
ch: ' ',
|
||||
inverse: true
|
||||
track: {
|
||||
bg: 'yellow'
|
||||
},
|
||||
style: {
|
||||
inverse: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user