diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-07-30 18:27:28 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-08-02 00:05:17 +0200 |
commit | a45400449536d75b4858821d88197fffefe66631 (patch) | |
tree | ed97f4e9f4e13f89f2123b6dd3bb55c3d73e2ac0 /sw/source/core/doc/DocumentContentOperationsManager.cxx | |
parent | f5f042fd0a8f107064763e04bdbbc098311e8d88 (diff) |
tdf#134436 sw: fix SwUndoDelete::RedoImpl() with section at end...
... of document; the root cause is that in some intermediate delete
operation, the delete will remove a section start/end node pair that
surrounds the last text node in the document, but
SwUndoDelete::RedoImpl() will not remove it, thus for subsequent Undo
actions the indexes are messed up and weird things happen.
Fix this in DocumentContentOperationsManager::DeleteRangeImplImpl(),
with the same weird "is point at the end" check as SwUndoDelete.
Change-Id: Iebf20d3c129c69692df8d57e3c5b9e6fec281e4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99810
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit 22a77cb83a3769a8b43d80565282988a74214866)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99858
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source/core/doc/DocumentContentOperationsManager.cxx')
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index af03431639b2..162b8389e463 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4235,6 +4235,19 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) if( aSttIdx != nEnde ) { + // tdf#134436 delete section nodes like SwUndoDelete::SwUndoDelete + SwNode *pTmpNd; + while (pEnd == rPam.GetPoint() + && nEnde + 2 < m_rDoc.GetNodes().Count() + && (pTmpNd = m_rDoc.GetNodes()[nEnde + 1])->IsEndNode() + && pTmpNd->StartOfSectionNode()->IsSectionNode() + && aSttIdx <= pTmpNd->StartOfSectionNode()->GetIndex()) + { + SwNodeRange range(*pTmpNd->StartOfSectionNode(), *pTmpNd); + m_rDoc.GetNodes().SectionUp(&range); + --nEnde; // account for deleted start node + } + // delete the Nodes into the NodesArary m_rDoc.GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() ); } |