[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 1 08:37:37 UTC 2018


 sw/source/core/text/txtfrm.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 3dfa702ad8edff68ec70ac8d8cdad91c7e9157a9
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Sep 21 15:51:02 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Oct 1 10:37:13 2018 +0200

    sw_redlinehide_2: avoid adjacent extents in UpdateMergedParaForDelete
    
    It's more efficient to keep the vector small, and
    UpdateMergedParaForInsert() may even assert in this case, so merge
    the extents.
    
    Change-Id: I8ffe47f27f667b4030d62db8f0119e45bfd62767
    Reviewed-on: https://gerrit.libreoffice.org/60931
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 9853beda6a09..fd9e02c5844e 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -855,7 +855,7 @@ TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
         if (it->pNode == &rNode)
         {
             ++nFoundNode;
-            if (nIndex + nToDelete <= it->nStart)
+            if (nIndex + nToDelete < it->nStart)
             {
                 nToDelete = 0;
                 if (!isRealDelete)
@@ -891,6 +891,15 @@ TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
                     {   // adjust for deleted text
                         it->nStart -= (nLen - nToDelete);
                         it->nEnd -= (nLen - nToDelete + nDeleteHere);
+                        if (it != rMerged.extents.begin()
+                            && (it-1)->pNode == &rNode
+                            && (it-1)->nEnd == it->nStart)
+                        {   // merge adjacent extents
+                            nTFIndex += it->nEnd - it->nStart;
+                            (it-1)->nEnd = it->nEnd;
+                            it = rMerged.extents.erase(it);
+                            bErase = true; // skip increment
+                        }
                     }
                     else
                     {   // exclude text marked as deleted


More information about the Libreoffice-commits mailing list