This is a patch to use 'par_type' offsets to ownerParagraphs().begin()
in LyXCursor.

The drawback is obvious: we have O(n) access in some cases where we had
O(1) before. However,I have not seen _any_ indication that this is
noticable after playing around with the UserGuide.

In any case, the benefits seem to clearly outweigh this: LyXCursor is
now 'copiable' and we can add asserts to the 'getPar()' set of functions
to catch accesses to 'uninitialized' cursor data early. And we've lost a
few dependency on ParagraphList_fwd.h.

The patch will need a bit of polishing, but unless somebody objects on
technical grounds I'll commit something similar soonish...

[Note that the patch is sort of 'minimalistic' and we probably could
make it nicer afterwards by accepting the offset in a few more places
(like redoParagraph)]

Andre'

Attachment: 1.diff.gz
Description: application/gunzip

Reply via email to