Alfredo Braunstein schrieb:
http://bugzilla.lyx.org/show_bug.cgi?id=3600

The problem is simply that stripLeadingSpaces is called on the last
paragraph of the selection and the endpos position is not adjusted if the
par shrinks.

Can someone remind me why do we need to call stripLeadingSpaces? Is this
something related to change tracking?
As stripLeadingSpace depends on "doClear", I can assure that it was not driven by change tracking. (though it has to consider CT!)

Some comments on your patch:

Index: src/CutAndPaste.cpp
===================================================================
--- src/CutAndPaste.cpp    (revision 18938)
+++ src/CutAndPaste.cpp    (working copy)
@@ -315,14 +309,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();

This looks suspicious (with and without your patch). Shouldn't the || in fact be a && ?

+            if (pit == endpit) {
+                endpos += pars[pit].size();
+                endpos -= nextsize - pars[endpit].size();
+                endpos = std::max(endpos, 0);
+            }

If pit == endpit, stripLeadingSpaces() is not invoked, right? It think something is wrong here...

Michael

Reply via email to