From b1eb026c6e3f4e941e60fabe65445263afcad03b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 18 Jul 2014 09:20:07 +0100 Subject: Fix bug #2154: List numbering. Previous list item box may not always be last child of parent. Search its previous children until a list item is found. --- render/box_construct.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'render') diff --git a/render/box_construct.c b/render/box_construct.c index ddb02e3e5..3404ca460 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -507,11 +507,20 @@ static bool box_construct_marker(struct box *box, const char *title, * BOX_BLOCK <-- list box * ... */ - while (last != NULL) { - if (last->list_marker != NULL) - break; + while (last != NULL && last->list_marker == NULL) { + struct box *last_inner = last; + + while (last_inner != NULL) { + if (last_inner->list_marker != NULL) + break; - last = last->last; + last_inner = last_inner->last; + } + if (last_inner != NULL) { + last = last_inner; + } else { + last = last->prev; + } } if (last && last->list_marker) { -- cgit v1.2.3