Michael Gerz wrote: > IIRC only Alfredo's patch #3600 and the Windows font patch are not > committed.
I didn't insist on mine because it is a bug caused by a dubious stripLeadingSpaces call but: - Bo already patched the code to avoid the crash - the problem seemingly only manifests itself with leading spaces, which are difficult to get in the first place - the stripLeadingSpace call should go in the end as JM observed. The patch is attached FWIW. Instead of applying the patch, I would prefer to either: 1) leave as it is and fix the thing correctly in 1.5.1. (too risky to do that now methinks). 2) just eliminate the call to stripLeadingSpaces. I don't have the time to investigate the consequences & test 2) exhaustively myself, so 1) is left ;-) A/
Index: CutAndPaste.cpp =================================================================== --- CutAndPaste.cpp (revision 19042) +++ CutAndPaste.cpp (working copy) @@ -303,12 +303,6 @@ for (pit_type pit = startpit; pit != endpit + 1;) { pos_type const left = (pit == startpit ? startpos : 0); pos_type right = (pit == endpit ? endpos : pars[pit].size() + 1); - // FIXME: this is a quick fix for bug 3600. It stops a crash but the problem - // still remains unsolved (e.g. the second example in the bug report). - // c.f. http://bugzilla.lyx.org/show_bug.cgi?id=3600 - if (right > pars[pit].size() + 1) - right = pars[pit].size() + 1; - bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges); // Logically erase only, including the end-of-paragraph character @@ -316,14 +310,17 @@ // Separate handling of paragraph break: if (merge && pit != endpit && - (pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) { - pos_type const thissize = pars[pit].size(); + (pit + 1 != endpit || pars[pit].hasSameLayout(pars[endpit]))) { + int const nextsize = pars[pit + 1].size(); if (doclear) pars[pit + 1].stripLeadingSpaces(params.trackChanges); + if (pit + 1 == endpit) { + endpos += pars[pit].size(); + endpos -= nextsize - pars[endpit].size(); + endpos = std::max(endpos, 0); + } mergeParagraph(params, pars, pit); --endpit; - if (pit == endpit) - endpos += thissize; } else ++pit; }