mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
cleanup render. ignore border option on scrollbar.
This commit is contained in:
parent
edc5535682
commit
a1e9ec5a55
@ -1338,16 +1338,16 @@ Box.prototype.render = function(stop) {
|
||||
, cl = content.length
|
||||
, battr
|
||||
, dattr
|
||||
, c;
|
||||
|
||||
var rtop
|
||||
, c
|
||||
, rtop
|
||||
, visible
|
||||
, hw
|
||||
, h
|
||||
, w
|
||||
, xll
|
||||
, yll
|
||||
, ret;
|
||||
, ret
|
||||
, cci;
|
||||
|
||||
if (this.position.width) {
|
||||
xl = xi_ + this.width;
|
||||
@ -1359,8 +1359,8 @@ Box.prototype.render = function(stop) {
|
||||
|
||||
// Check to make sure we're visible and inside of the visible scroll area.
|
||||
if (this.parent.childBase != null && (!this.parent.items || ~this.parent.items.indexOf(this))) {
|
||||
var rtop = this.rtop - (this.parent.border ? 1 : 0)
|
||||
, visible = this.parent.height - (this.parent.border ? 2 : 0);
|
||||
rtop = this.rtop - (this.parent.border ? 1 : 0);
|
||||
visible = this.parent.height - (this.parent.border ? 2 : 0);
|
||||
|
||||
yi_ -= this.parent.childBase;
|
||||
yl = Math.min(yl, this.screen.rows - this.parent.bottom - (this.parent.border ? 1 : 0));
|
||||
@ -1368,6 +1368,7 @@ Box.prototype.render = function(stop) {
|
||||
if (rtop - this.parent.childBase < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rtop - this.parent.childBase >= visible) {
|
||||
return;
|
||||
}
|
||||
@ -1376,11 +1377,12 @@ Box.prototype.render = function(stop) {
|
||||
// TODO: Check for 'center', recalculate yi, and xi. Better
|
||||
// yet, simply move this check into this.left/width/etc.
|
||||
if (this.shrink) {
|
||||
var hw = this._getShrinkSize(content)
|
||||
, h = hw.height
|
||||
, w = hw.width
|
||||
, xll = xl
|
||||
, yll = yl;
|
||||
hw = this._getShrinkSize(content);
|
||||
h = hw.height;
|
||||
w = hw.width;
|
||||
xll = xl;
|
||||
yll = yl;
|
||||
|
||||
if (this.options.width == null
|
||||
&& (this.options.left == null
|
||||
|| this.options.right == null)) {
|
||||
@ -1392,6 +1394,7 @@ Box.prototype.render = function(stop) {
|
||||
//xl++; // make it one cell wider for newlines
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.height == null
|
||||
&& (this.options.top == null
|
||||
|| this.options.bottom == null)
|
||||
@ -1402,12 +1405,14 @@ Box.prototype.render = function(stop) {
|
||||
yl = yi_ + h + (this.border ? 2 : 0) + this.padding;
|
||||
}
|
||||
}
|
||||
|
||||
// Recenter shrunken elements.
|
||||
if (xl < xll && this.options.left === 'center') {
|
||||
xll = (xll - xl) / 2 | 0;
|
||||
xi_ += xll;
|
||||
xl += xll;
|
||||
}
|
||||
|
||||
if (yl < yll && this.options.top === 'center') {
|
||||
yll = (yll - yl) / 2 | 0;
|
||||
yi_ += yll;
|
||||
@ -1415,7 +1420,7 @@ Box.prototype.render = function(stop) {
|
||||
}
|
||||
}
|
||||
|
||||
var ret = this._lastPos = {
|
||||
ret = this._lastPos = {
|
||||
xi: xi_,
|
||||
xl: xl,
|
||||
yi: yi_,
|
||||
@ -1433,7 +1438,7 @@ Box.prototype.render = function(stop) {
|
||||
|
||||
// Check previous line for escape codes.
|
||||
if (this.contentIndex != null && this.childBase > 0 && this._clines) {
|
||||
var cci = ci - (this._clines[this.childBase - 1].length + 1);
|
||||
cci = ci - (this._clines[this.childBase - 1].length + 1);
|
||||
for (; cci < ci; cci++) {
|
||||
if (content[cci] === '\x1b') {
|
||||
if (c = /^\x1b\[[\d;]*m/.exec(content.substring(cci))) {
|
||||
@ -1509,6 +1514,7 @@ outer:
|
||||
h = this.items ? this.items.length : this._clines.length;
|
||||
if (this.scrollbar && (yl - yi_) < h) {
|
||||
xi = xl - 1;
|
||||
if (this.scrollbar.ignoreBorder && this.border) xi++;
|
||||
yi = h - (yl - yi_) - (this.border ? 2 : 0);
|
||||
yi = yi_ + (((yl - yi_) * (this.childBase / yi)) | 0);
|
||||
cell = lines[yi] && lines[yi][xi];
|
||||
|
Loading…
x
Reference in New Issue
Block a user