[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 3b677bf 1/2: Don't add extra page if there ar
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 3b677bf 1/2: Don't add extra page if there are no more rows in group quotes |
Date: |
Fri, 26 Oct 2018 06:15:25 -0400 (EDT) |
branch: master
commit 3b677bf844ab7e77e6338ebc1350abf9293ee2be
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Don't add extra page if there are no more rows in group quotes
Check if there is enough space left on the current page before
outputting a new row, as we can be certain that we do need a new page in
this case.
Previous code had a bug when the total number of rows was exactly equal
to the number fitting on the first page as it added a superfluous page
in this case, resulting in an assertion failure later and wrong output.
---
group_quote_pdf_gen_wx.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 1d56f14..5893a1d 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -750,9 +750,8 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
}
}
- table_gen.output_row(pos_y, visible_values);
-
- // If there is no space left for another row, start a new page.
+ // If there is no space left for this row on the current page, start a
+ // new one.
if(last_row_y <= pos_y + table_gen.row_height())
{
output_page_number_and_version(pdf_writer, total_pages,
current_page);
@@ -763,6 +762,8 @@ void group_quote_pdf_generator_wx::save(std::string const&
output_filename)
pos_y = pdf_writer.get_vert_margin();
table_gen.output_headers(pos_y);
}
+
+ table_gen.output_row(pos_y, visible_values);
}
if(footer_on_its_own_page)