From 897630ecb964e8de640d1e3410af27b26bc27e46 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Sun, 16 Feb 2014 01:56:25 -0800 Subject: [PATCH] Fix some issues with indentation in the line wrapper --- lib/line_wrapper.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/line_wrapper.coffee b/lib/line_wrapper.coffee index 0c9fffd..f68821f 100644 --- a/lib/line_wrapper.coffee +++ b/lib/line_wrapper.coffee @@ -7,19 +7,21 @@ class LineWrapper extends EventEmitter @on 'firstLine', (options) => indent = options.indent or 0 @document.x += indent - options.lineWidth -= indent + @lineWidth -= indent @once 'line', => @document.x -= indent - options.lineWidth += indent + @lineWidth += indent @on 'lastLine', (options) => align = options.align options.align = 'left' if align is 'justify' + @lastLine = true @once 'line', => @document.y += options.paragraphGap or 0 options.align = align + @lastLine = false wrap: (paragraphs, options) -> width = @document.widthOfString.bind(@document)