The text function does not render text containing line breaks/carriage returns as documented in the source code. The issue has occurred to me in Limesurvey.
The purpose of this contribution is twofold:
1) To get the text function working as documented
2) Avoid the use of coercing and joining of lines followed by the use of the lines function.
It seems to me, you do not provide examples with text spanning several lines besides the use of the lines function. Please add functionality so that line breaks, carriage returns etc. are identified and text is type set correctly without need for further programming.
Thanks!
Are you using Linux as Operating System?
If so, the problem is the regex expression
// If there are any newlines in text, we assume
// the user wanted to print multiple lines, so break the
// text up into an array. If the text is already an array,
// we assume the user knows what they are doing.
// Convert text into an array anyway to simplify
// later code.
if (typeof text === 'string') {
if (text.match(/[\n\r]/)) {
text = text.split(/\r\n|\r|\n/g);
} else {
text = [text];
}
}
Probably changing
if (text.match(/[\n\r]/)) {
to
if (text.match(/[\r?\n]/)) {
will do the trick
Not working when parameter maxWidthis set.
Most helpful comment
Not working when parameter
maxWidthis set.