more scroll work.

This commit is contained in:
Christopher Jeffrey 2013-07-27 05:14:02 -05:00
parent d63762fbe8
commit ee71a1ac61
2 changed files with 18 additions and 9 deletions

View File

@ -2495,7 +2495,7 @@ Element.prototype.__defineGetter__('tpadding', function() {
});
/**
* Rendering
* Rendering - here be dragons
*/
Element.prototype._getShrinkSize = function() {
@ -2636,6 +2636,7 @@ Element.prototype._getCoords = function(get) {
, coords
, v
, base
, cbase
, notop
, nobot;
@ -2670,8 +2671,11 @@ Element.prototype._getCoords = function(get) {
} else {
// Is partially covered below.
notop = true;
v = (this.parent.lpos.yi + this.parent.itop) - yi;
v = (this.parent.lpos.yi + 0) - yi;
//if (!this.itop) v += this.parent.itop;
v += this.parent.itop - this.itop;
base = (this.childBase || 0) + v;
cbase = base;
yi += v;
}
} else if (yl > this.parent.lpos.yl - this.parent.ibottom) {
@ -2681,7 +2685,8 @@ Element.prototype._getCoords = function(get) {
} else {
// Is partially covered below.
nobot = true;
v = yl - (this.parent.lpos.yl - this.parent.ibottom);
v = yl - (this.parent.lpos.yl - 0);
v += this.parent.ibottom - this.ibottom;
yl -= v;
}
}
@ -2695,13 +2700,13 @@ Element.prototype._getCoords = function(get) {
xl: xl,
yi: yi,
yl: yl,
base: base || this.childBase || 0,
base: base != null ? base : this.childBase || 0,
cbase: cbase != null ? cbase : this.childBase || 0,
notop: notop,
nobot: nobot
};
};
// Here be dragons.
Element.prototype.render = function() {
this.emit('prerender');
@ -2724,7 +2729,7 @@ Element.prototype.render = function() {
, attr
, ch
, content = this._pcontent
, ci = this._clines.ci[coords.base]
, ci = this._clines.ci[coords.cbase]
, battr
, dattr
, c
@ -2744,14 +2749,16 @@ Element.prototype.render = function() {
// If we're in a scrollable text box, check to
// see which attributes this line starts with.
if (ci > 0) {
attr = this._clines.attr[Math.min(coords.base, this._clines.length - 1)];
attr = this._clines.attr[Math.min(coords.cbase, this._clines.length - 1)];
}
if (this.border) xi++, xl--, yi++, yl--;
/*
if (this.border) {
if (coords.notop) yi--;
if (coords.nobot) yl++;
}
*/
// If we have padding/valign, that means the
// content-drawing loop will skip a few cells/lines.
@ -2862,10 +2869,12 @@ Element.prototype.render = function() {
}
if (this.border) xi--, xl++, yi--, yl++;
/*
if (this.border) {
//if (coords.notop) yi++;
if (coords.nobot) yl--;
}
*/
if (this.tpadding) {
xi -= this.padding.left, xl += this.padding.right;
@ -2896,7 +2905,7 @@ Element.prototype.render = function() {
}
}
y = yi + 1;
for (; y < yl; y++) {
for (; y < yl - 1; y++) {
if (!lines[y]) break;
if (this.border.type === 'line') {
ch = '│';

View File

@ -54,7 +54,7 @@ var text2 = blessed.box({
var box2 = blessed.box({
parent: box,
scrollable: true,
content: 'foo-one\nfoo-two',
content: 'foo-one\nfoo-two\nfoo-three',
left: 'center',
top: 20,
width: '80%',