2010/12/18 Abdelrazak Younes <you...@lyx.org> > On 18/12/2010 19:33, Jean-Marc Lasgouttes wrote: > >> Le 18 déc. 2010 à 19:08, Abdelrazak Younes a écrit : >> >> On 18/12/2010 18:57, Jean-Marc Lasgouttes wrote: >>> >>>> Le 18 déc. 2010 à 17:41, Abdelrazak Younes a écrit : >>>> >>>>> What part of that could possibly go to branch? >>>>>> >>>>> I guess introducing RandomListAccess::position() and using it will be >>>>> enough. >>>>> >>>> Why does this remove the quadratic behaviour? >>>> >>> distance(it1, it2) = paragraphs.position(it2) - paragraphs.position(it1); >>> >> But position() is linear, like std::distance(). >> > > std::distance() advances the std::list iterator while > RandomAccessList::position() look for the std::list iterator copies. The > copies are in a vector so I assume this is faster. > > > > But as I said before, maybe the fix is as simple as this: >>> - if (distance(lastpar, par)>= distance(lastpar, endpar)) >>> + >>> + if (par == endpar) >>> break; >>> >> I thought this broke source view. >> > > endpar is either paragraphs.end() or is given by the source view so it > should work. > > Abdel. > > Hello Abdel,
i didn't look into the code but following your arguments in this thread there seems to be a problem: - TeXOnePar may jump by more than one par - endpar is either paragraphs.end() or is given by the source view if this is true then the condition par == endpar is wrong because your earlier argument "... it can't go above paragraphs.end(), there's nothing above" doesn't hold because there can be something above endpar. bernhard