When a large paragraph is split across blocks, don't treat the continuation as a new paragraph

This commit is contained in:
spfenwick
2026-05-02 16:07:27 +12:00
parent 5928f32364
commit 40c3ecbada
3 changed files with 19 additions and 9 deletions
@@ -1592,13 +1592,17 @@ void ChapterHtmlSlimParser::makePages() {
const int lineHeight = renderer.getLineHeight(fontId) * lineCompression;
// Apply top spacing before the paragraph (stored in pixels)
// Apply top spacing before the paragraph — skip for continuation fragments
// (words left over after an intermediate flush): the top margin was already
// applied before the first set of lines from this logical paragraph.
const BlockStyle& blockStyle = currentTextBlock->getBlockStyle();
if (blockStyle.marginTop > 0) {
currentPageNextY += blockStyle.marginTop;
}
if (blockStyle.paddingTop > 0) {
currentPageNextY += blockStyle.paddingTop;
if (!currentTextBlock->isContinuation()) {
if (blockStyle.marginTop > 0) {
currentPageNextY += blockStyle.marginTop;
}
if (blockStyle.paddingTop > 0) {
currentPageNextY += blockStyle.paddingTop;
}
}
// Calculate effective width accounting for horizontal margins/padding