Jeremias Maerki wrote:
One of my clients reported to me that he gets a "Should be first" error
message on the log. This happens in (Page)BreakingAlgorithm.removeNode().
I get the impression that the code there is not finished rather than
that is a real error condition. I'll try to extend removeNode() so it
really removes the disabled node.
That's quite strange ...
The reason why the to-be-removed node should be the first one is this:
active nodes are ordered by line (page) number and by index of the element
where the feasible break can happen, so, for example, a node representing
a break for page 13 at element #150 is (or at least it should be) before a
break for page 13 at element #152;
a node is removed when it is too far from the current feasible break being
evaluated (or, in other words, from the node and the current position
there is too much content to be placed in a single line / page), so in
"normal" situations nodes are removed in order: for example, if we are
evaluating a break at element #180, and we are too far from the node
representing the break for page 13 at element #152, we will have already
removed the node representing a break at page 13 element #150 (as it will
be farther from the current element);
this could be no more true when there are footnotes: for example the break
at element #152 could represent a page where we have placed one more
"normal" line in page 13, but fewer footnote lines with regard to the
break at element #150, so the node coming first allows to place more
content than the following one, and we could need to remove the node at
#152 *before* the one at element #150
However, this does not explain why this warning shows in what appears to
be a very simple document.
I'm going to have a closer look ...
Regards
Luca