mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
fix cut-off tags when wrapping is disabled. fixes #50.
This commit is contained in:
parent
6694b35ee4
commit
c0f85b2567
@ -2163,7 +2163,8 @@ Element.prototype._wrapContent = function(content, width) {
|
||||
, i
|
||||
, part
|
||||
, j
|
||||
, lines;
|
||||
, lines
|
||||
, rest;
|
||||
|
||||
lines = content.split('\n');
|
||||
|
||||
@ -2202,12 +2203,6 @@ main:
|
||||
}
|
||||
}
|
||||
|
||||
// If we're not wrapping, just chop
|
||||
// the string off at the width.
|
||||
if (!wrap && line.length > width) {
|
||||
line = line.slice(0, width);
|
||||
}
|
||||
|
||||
// If the string is apparently too long, wrap it.
|
||||
while (line.length > width) {
|
||||
// Measure the real width of the string.
|
||||
@ -2217,6 +2212,16 @@ main:
|
||||
}
|
||||
if (!line[i]) break;
|
||||
if (++total === width) {
|
||||
// If we're not wrapping the text, we have to finish up the rest of
|
||||
// the control sequences before cutting off the line.
|
||||
if (!wrap) {
|
||||
rest = line.substring(i).match(/\x1b\[[^m]*m/g);
|
||||
rest = rest ? rest.join('') : '';
|
||||
out.push(this._align(line.substring(0, i) + rest, width, align));
|
||||
ftor[no].push(out.length - 1);
|
||||
rtof.push(no);
|
||||
continue main;
|
||||
}
|
||||
// Try to find a space to break on.
|
||||
if (line[i] !== ' ') {
|
||||
j = i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user