From 22db387d0853582a4036785adb5721b6e43f370e Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 29 Jun 2011 13:32:28 +0000 Subject: [PATCH] Backport fix for #7463 to branch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39210 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_xhtml.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 8d1be2bb14..dee3060e59 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -924,11 +924,20 @@ void xhtmlParagraphs(Text const & text, OutputParams const & runparams) { ParagraphList const & paragraphs = text.paragraphs(); - ParagraphList::const_iterator par = paragraphs.begin(); - ParagraphList::const_iterator pend = paragraphs.end(); + if (runparams.par_begin == runparams.par_end) { + runparams.par_begin = 0; + runparams.par_end = paragraphs.size(); + } + pit_type bpit = runparams.par_begin; + pit_type const epit = runparams.par_end; + LASSERT(bpit < epit, /* */); OutputParams ourparams = runparams; - while (par != pend) { + ParagraphList::const_iterator const pend = + (epit == (int) paragraphs.size()) ? + paragraphs.end() : paragraphs.constIterator(epit); + while (bpit < epit) { + ParagraphList::const_iterator par = paragraphs.constIterator(bpit); if (par->params().startOfAppendix()) { // FIXME: only the counter corresponding to toplevel // sectioning should be reset @@ -937,7 +946,7 @@ void xhtmlParagraphs(Text const & text, cnts.appendix(true); } Layout const & style = par->layout(); - ParagraphList::const_iterator lastpar = par; + ParagraphList::const_iterator const lastpar = par; ParagraphList::const_iterator send; switch (style.latextype) { @@ -974,10 +983,7 @@ void xhtmlParagraphs(Text const & text, par = makeParagraphs(buf, xs, ourparams, text, par, send); break; } - // FIXME?? - // makeEnvironment may process more than one paragraphs and bypass pend - if (distance(lastpar, par) >= distance(lastpar, pend)) - break; + bpit += distance(lastpar, par); } }