mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
fix scrollbar arithmetic.
This commit is contained in:
parent
69f5993735
commit
8f989eeadd
@ -2838,17 +2838,19 @@ Element.prototype.render = function() {
|
||||
|
||||
// Draw the scrollbar.
|
||||
if (this.scrollbar) {
|
||||
i = Math.max(this._clines.length + 1,
|
||||
this._scrollBottom() + (yl - yi) + 1);
|
||||
i = Math.max(this._clines.length, this._scrollBottom());
|
||||
}
|
||||
if (coords.notop || coords.nobot) i = -Infinity;
|
||||
if (this.scrollbar && (yl - yi) < i) {
|
||||
i -= yl - yi;
|
||||
x = xl - 1;
|
||||
if (this.scrollbar.ignoreBorder && this.border) x++;
|
||||
y = this.childBase + this.childOffset;
|
||||
y = y / i;
|
||||
if (this.alwaysScroll) {
|
||||
y = this.childBase / (i - (yl - yi));
|
||||
} else {
|
||||
y = (this.childBase + this.childOffset) / i;
|
||||
}
|
||||
y = yi + ((yl - yi) * y | 0);
|
||||
if (y >= yl) y = yl - 1;
|
||||
cell = lines[y] && lines[y][x];
|
||||
if (cell) {
|
||||
ch = this.scrollbar.ch || ' ';
|
||||
|
Loading…
x
Reference in New Issue
Block a user