Skip to content

Commit

Permalink
add ignoreDockContrast option.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed May 2, 2015
1 parent 0ea19ca commit b5341b8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ The screen on which every other node renders.
│ box1 │ box2 │
└─────────┴─────────┘
```
- __ignoreDockContrast__ - normally, dockable borders will not dock if the
colors or attributes are different. this option will allow them to dock
regardless. it may produce some odd looking multi-colored borders though.
- __fullUnicode__ - allow for rendering of East Asian double-width characters,
utf-16 surrogate pairs, and unicode combining characters. this allows you to
display text above the basic multilingual plane. this is behind an option
Expand Down
25 changes: 15 additions & 10 deletions example/multiplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ var blessed = require('blessed')

screen = blessed.screen({
smartCSR: true,
log: process.env.HOME + '/blessed-terminal.log'
log: process.env.HOME + '/blessed-terminal.log',
fullUnicode: true,
dockBorders: true,
ignoreDockContrast: true
});

var left = blessed.terminal({
Expand All @@ -23,10 +26,11 @@ var left = blessed.terminal({
cursorBlink: true,
screenKeys: false,
left: 0,
top: 2,
bottom: 2,
width: '40%',
border: 'line',
top: 0,
width: '50%',
border: {
type: 'line',
},
style: {
fg: 'default',
bg: 'default',
Expand All @@ -47,11 +51,12 @@ var right = blessed.terminal({
cursor: 'block',
cursorBlink: true,
screenKeys: false,
right: 2,
top: 2,
bottom: 2,
width: '40%',
border: 'line',
left: '50%-1',
top: 0,
width: '50%+1',
border: {
type: 'line',
},
style: {
fg: 'red',
bg: 'black',
Expand Down
16 changes: 12 additions & 4 deletions lib/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -1086,22 +1086,30 @@ Screen.prototype._getAngle = function(lines, x, y) {
, ch = lines[y][x][1];

if (lines[y][x - 1] && langles[lines[y][x - 1][1]]) {
if (lines[y][x - 1][0] !== attr) return ch;
if (!this.options.ignoreDockContrast) {
if (lines[y][x - 1][0] !== attr) return ch;
}
angle |= 1 << 3;
}

if (lines[y - 1] && uangles[lines[y - 1][x][1]]) {
if (lines[y - 1][x][0] !== attr) return ch;
if (!this.options.ignoreDockContrast) {
if (lines[y - 1][x][0] !== attr) return ch;
}
angle |= 1 << 2;
}

if (lines[y][x + 1] && rangles[lines[y][x + 1][1]]) {
if (lines[y][x + 1][0] !== attr) return ch;
if (!this.options.ignoreDockContrast) {
if (lines[y][x + 1][0] !== attr) return ch;
}
angle |= 1 << 1;
}

if (lines[y + 1] && dangles[lines[y + 1][x][1]]) {
if (lines[y + 1][x][0] !== attr) return ch;
if (!this.options.ignoreDockContrast) {
if (lines[y + 1][x][0] !== attr) return ch;
}
angle |= 1 << 0;
}

Expand Down

0 comments on commit b5341b8

Please sign in to comment.