mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
alignment refactor.
This commit is contained in:
parent
4f199c26aa
commit
59b13fae82
@ -1047,16 +1047,13 @@ Box.prototype.render = function(stop) {
|
||||
}
|
||||
|
||||
if (this.align === 'center' || this.align === 'right') {
|
||||
//var width = this.width - (this.border ? 2 : 0);
|
||||
var width = this.width;
|
||||
var ncontent = content.split('\n')[0].replace(/\x1b\[[^m]*m/g, '');
|
||||
var ncontent = content.split('\n')[0].replace(/\x1b\[[\d;]*m/g, '')
|
||||
, width = this.width;
|
||||
if (ncontent.length < width) {
|
||||
var s = width - ncontent.length;
|
||||
if (this.align === 'center') {
|
||||
//xi_ += s / 2 | 0;
|
||||
content = Array(((s / 2 | 0) - (this.border ? 1 : 0)) + 1).join(' ') + content;
|
||||
} else {
|
||||
//xi_ += s;
|
||||
content = Array((s - (this.border ? 2 : 0)) + 1).join(' ') + content;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user