Fix infinite loop when lineWidth is smaller than width of a character. Not sure about what to do in this case yet.

This commit is contained in:
VincentGuinaudeau 2019-09-11 14:57:51 +02:00
parent 1228c259bd
commit 17e08a66dd

View File

@ -123,6 +123,10 @@ class LineWrapper extends EventEmitter {
}
}
if (l === 0 && this.spaceLeft === this.lineWidth) {
l = 1;
}
// send a required break unless this is the last piece and a linebreak is not specified
fbk.required = bk.required || l < word.length;
shouldContinue = fn(word.slice(0, l), w, fbk, lbk);