From 3aab724ccbcc90e1a28939d10e94c8cab51cee4f Mon Sep 17 00:00:00 2001 From: Fabio Kruger Date: Tue, 8 Dec 2020 19:52:38 +0100 Subject: [PATCH] Add new line at the end of continued section Signed-off-by: Fabio Kruger --- lib/line_wrapper.js | 8 ++++++++ lib/mixins/text.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/line_wrapper.js b/lib/line_wrapper.js index a53f17a13..00990735a 100644 --- a/lib/line_wrapper.js +++ b/lib/line_wrapper.js @@ -284,6 +284,14 @@ class LineWrapper extends EventEmitter { emitLine(); } + // Add a line break in the continued section + if (options.continued === true && options.lineBreakAfter === true) { + buffer = "" + wc = 0; + textWidth = 0; + emitLine(); + } + this.emit('sectionEnd', options, this); // if the wrap is set to be continued, save the X position diff --git a/lib/mixins/text.js b/lib/mixins/text.js index 43903abd3..baed1df9d 100644 --- a/lib/mixins/text.js +++ b/lib/mixins/text.js @@ -199,7 +199,8 @@ export default { if (this._textOptions) { for (let key in this._textOptions) { const val = this._textOptions[key]; - if (key !== 'continued') { + // We don't carry over these options + if (key !== 'continued' && key !== 'lineBreakAfter') { if (result[key] === undefined) { result[key] = val; }