Bug Hunting Session
Bug 88603 - FORMATTING: 'Keep with next paragraph' should have priority over the next paragraph's 'Do not split paragraph' if that next paragraph won't fit on one page anyway.
Summary: FORMATTING: 'Keep with next paragraph' should have priority over the next par...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.5.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-20 01:05 UTC by Sascha Fichtner
Modified: 2015-05-04 15:53 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Simple repro showcasing the splitting of two paragraphs that ought to be kept together. (10.32 KB, application/vnd.oasis.opendocument.text)
2015-01-20 01:05 UTC, Sascha Fichtner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Fichtner 2015-01-20 01:05:53 UTC
Created attachment 112506 [details]
Simple repro showcasing the splitting of two paragraphs that ought to be kept together.

Problem description:
First, my understanding of how things work in LibreOffice... please correct me if I'm wrong. :)

With the 'Do not split paragraph' option set, LibreOffice moves a paragraph immediately to a new page once it figures out that this paragraph won't fit on the current page. If the previous paragraph has the 'Keep with next paragraph' option set, LibreOffice will try to keep those two paragraphs together, i.e. if they both fit on the current page, they remain there, otherwise if they both fit on a new, empty page, they will be moved to the next page. However if both paragraphs combined will span more than one page, LibreOffice will separate them, prioritizing the 2nd paragraph's 'Do not split' over the 1st paragraph's 'Keep with next' setting. Once the 2nd paragraph would span more than one page by itself however, the 'Keep with next' setting should have a higher priority again as nothing is really gained from moving only the 2nd paragraph to the next page (as it won't completely fit there anyway).

Furthermore it might be arguable if, should paragraph 2 fit exactly on one page by itself but would span more than one page if kept together with paragraph 1, the 'Keep with next' option should always have a higher priority as the 1st paragraph might e.g. serve as some kind of header to the bulk of content in the 2nd paragraph and as such should always visually remain with that content.

As far as I know LibreOffice behaves the way as Microsoft Word does, and I know I could always disable the 2nd paragraph's 'Do not split' option manually in this case but I am hitting this 'issue' when importing a huge auto-generated .rtf file with dozens to hundreds of these cases... so I thought I'd raise the issue here at least to see if I am alone in this or not. :)

Steps to reproduce:
Load the attached .odt file.

Current behavior:
'Paragraph 1' (which has the 'Keep with next' option set) ends up all alone on page 1.
'Paragraph 2' (which has the 'Do not split' option set) ends up on page 2.

Expected behavior:
'Paragraph 2' should also end up on page 1, immediately following 'Paragraph 1' (due to the 1st paragraph's
'Keep with next' option being set and Paragraph 2 not fitting on page 2 in its entirety in the first place).
Comment 1 Justin L 2015-05-04 15:53:57 UTC
You are correct, this is the same behaviour as MS Word 2003.  And that basically also answers the question as to whether this is correct behaviour.  We need to mimic MSOffice for document compatibility, so this is not a bug.