Skip to content

Commit

Permalink
resolves #1121 read padding from correct box when creating new page
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Jul 25, 2019
1 parent c5842a2 commit 6c93344
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/prawn/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -720,15 +720,17 @@ def generate_margin_box
(page.margins[:top] + page.margins[:bottom])
)

# This check maintains indentation settings across page breaks
# update bounding box if not flowing from the previous page
unless @bounding_box && @bounding_box.parent
old_margin_box = @bounding_box
@bounding_box = @margin_box
end

# maintains indentation settings across page breaks
if old_margin_box
@margin_box.add_left_padding(old_margin_box.total_left_padding)
@margin_box.add_right_padding(old_margin_box.total_right_padding)
end

# we must update bounding box if not flowing from the previous page
#
@bounding_box = @margin_box unless @bounding_box&.parent
end

def apply_margin_options(options)
Expand Down

0 comments on commit 6c93344

Please sign in to comment.