allow docking borders to obscured by screen edges.

This commit is contained in:
Christopher Jeffrey 2015-04-04 06:36:28 -07:00
parent 15d09e7ce1
commit f6b5b8811a
2 changed files with 94 additions and 7 deletions

View File

@ -3906,11 +3906,11 @@ Element.prototype.render = function() {
y = yi; y = yi;
if (coords.notop) y = -1; if (coords.notop) y = -1;
for (x = xi; x < xl; x++) { for (x = xi; x < xl; x++) {
if (!lines[y]) break; if (!lines[y]) continue;
if (coords.noleft && x === xi) continue; if (coords.noleft && x === xi) continue;
if (coords.noright && x === xl - 1) continue; if (coords.noright && x === xl - 1) continue;
cell = lines[y][x]; cell = lines[y][x];
if (!cell) break; if (!cell) continue;
if (this.border.type === 'line') { if (this.border.type === 'line') {
if (x === xi) { if (x === xi) {
ch = '\u250c'; // '┌' ch = '\u250c'; // '┌'
@ -3980,9 +3980,9 @@ Element.prototype.render = function() {
} }
y = yi + 1; y = yi + 1;
for (; y < yl - 1; y++) { for (; y < yl - 1; y++) {
if (!lines[y]) break; if (!lines[y]) continue;
cell = lines[y][xi]; cell = lines[y][xi];
if (!cell) break; if (!cell) continue;
if (this.border.type === 'line') { if (this.border.type === 'line') {
ch = '\u2502'; // '│' ch = '\u2502'; // '│'
if (this.screen.dockBorders || this.dockBorders) { if (this.screen.dockBorders || this.dockBorders) {
@ -4002,7 +4002,7 @@ Element.prototype.render = function() {
lines[y].dirty = true; lines[y].dirty = true;
} }
cell = lines[y][xl - 1]; cell = lines[y][xl - 1];
if (!cell) break; if (!cell) continue;
if (this.border.type === 'line') { if (this.border.type === 'line') {
ch = '\u2502'; // '│' ch = '\u2502'; // '│'
if (this.screen.dockBorders || this.dockBorders) { if (this.screen.dockBorders || this.dockBorders) {
@ -4038,11 +4038,11 @@ Element.prototype.render = function() {
y = yl - 1; y = yl - 1;
if (coords.nobot) y = -1; if (coords.nobot) y = -1;
for (x = xi; x < xl; x++) { for (x = xi; x < xl; x++) {
if (!lines[y]) break; if (!lines[y]) continue;
if (coords.noleft && x === xi) continue; if (coords.noleft && x === xi) continue;
if (coords.noright && x === xl - 1) continue; if (coords.noright && x === xl - 1) continue;
cell = lines[y][x]; cell = lines[y][x];
if (!cell) break; if (!cell) continue;
if (this.border.type === 'line') { if (this.border.type === 'line') {
if (x === xi) { if (x === xi) {
ch = '\u2514'; // '└' ch = '\u2514'; // '└'

View File

@ -0,0 +1,87 @@
var blessed = require('../')
, screen;
screen = blessed.screen({
dump: __dirname + '/logs/dock.log',
smartCSR: true,
dockBorders: true
});
blessed.box({
parent: screen,
left: -1,
top: -1,
width: '50%+1',
height: '50%+1',
border: 'line',
content: 'Foo'
});
blessed.box({
parent: screen,
left: '50%-1',
top: -1,
width: '50%+3',
height: '50%+1',
content: 'Bar',
border: 'line'
});
blessed.box({
parent: screen,
left: -1,
top: '50%-1',
width: '50%+1',
height: '50%+3',
border: 'line',
content: 'Foo'
});
blessed.listtable({
parent: screen,
left: '50%-1',
top: '50%-1',
width: '50%+3',
height: '50%+3',
border: 'line',
align: 'center',
tags: true,
keys: true,
vi: true,
mouse: true,
style: {
header: {
fg: 'blue',
bold: true
},
cell: {
fg: 'magenta',
selected: {
bg: 'blue'
}
}
},
data: [
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
[ 'Elephant', 'Apple', '1:00am', 'One' ],
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
]
}).focus();
// blessed.box({
// parent: screen,
// left: '50%-1',
// top: '50%-1',
// width: '50%+1',
// height: '50%+1',
// border: 'line',
// content: 'Bar'
// });
screen.key('q', function() {
return process.exit(0);
});
screen.render();