From b5341b8b8194385dfa02fca20b6af3289edbb837 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 1 May 2015 21:09:40 -0700 Subject: [PATCH] add ignoreDockContrast option. --- README.md | 3 +++ example/multiplex.js | 25 +++++++++++++++---------- lib/widget.js | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 97fdd8c..d3178bf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/example/multiplex.js b/example/multiplex.js index 0093705..bd216d2 100755 --- a/example/multiplex.js +++ b/example/multiplex.js @@ -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({ @@ -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', @@ -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', diff --git a/lib/widget.js b/lib/widget.js index ae617a6..6f7e63b 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -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; }