Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: | John Levon wrote: >> Sure. When we do erase(0, size()), that uses the paragraph_pimpl erase() >> function, and that updates the change table. For old text, it does not >> delete the chars. >> So, we only remove the paragraph is its size is now 0 - this implies >> that it was a paragraph that was entirely new (blue), so can be removed >> altogether. Otherwise, we have to keep it. > | What about this patch, then? It is like the old code, except that it | deletes stuff by chunks. It is still slower than Lars' solution, so I | guess we could short-circuit it when change tracking is not enabled. > | JMarcFpr > | Index: src/CutAndPaste.C | =================================================================== | RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/CutAndPaste.C,v | retrieving revision 1.155 | diff -u -p -r1.155 CutAndPaste.C | --- src/CutAndPaste.C 19 Jul 2005 13:17:01 -0000 1.155 | +++ src/CutAndPaste.C 20 Jul 2005 22:32:10 -0000 | @@ -277,9 +277,41 @@ PitPosPair eraseSelectionHelper(BufferPa | if (endpos != 0) | all_erased = false; |
if (!changeTracking()) { | - // Erase all the "middle" paragraphs. | - pars.erase(pars.begin() + startpit + 1, pars.begin() + endpit); | - endpit = startpit + 1; } else { ParagraphIterator start = pars.begin() + startpit + 1; ParagraphIterator end = pars.begin() + endpit; for (; start != end; ++start) { start->erase(0, start->size()); } } How wrong would that be? At the very least I'd like an explict check on change tracking. -- Lgb