sw/source/core/doc/DocumentContentOperationsManager.cxx | 9 ++++++++- sw/source/core/undo/undel.cxx | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-)
New commits: commit 27613259990d39d34b036b3d717d3ceaf5c15e65 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Jul 28 19:12:19 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed Jul 29 10:34:24 2020 +0200 tdf#134250 sw_redlinehide: fix Undo with section before table ... at start of document, part 2: In SwUndoDelete::UndoImpl(), the m_aEndStr wasn't inserted, because the pTextNd was a section node. This caused asserts when trying to add the history hints that used to be in the end text node. thints.cxx:1295: bool SwTextNode::InsertHint(SwTextAttr*, SetAttrMode): Assertion `!pAttr->GetEnd() || (*pAttr->GetEnd() <= Len())' failed. (regression from 57d488660572d62ef0371e50dcdd4ca7a6d98a14) Change-Id: I48caa7487d2d1e6250b5aceab18f270555d3ee8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99644 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 6a171cbe6730..6a2cf5570640 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -883,7 +883,17 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if( m_aEndStr ) { // discard attributes since they all saved! - SwTextNode* pTextNd = aPos.nNode.GetNode().GetTextNode(); + SwTextNode * pTextNd; + if (!m_bDelFullPara && aPos.nNode.GetNode().IsSectionNode()) + { // tdf#134250 section node wasn't deleted; but aPos must point to it in bNodeMove case below + assert(m_nSttContent == 0); + assert(!m_aSttStr); + pTextNd = rDoc.GetNodes()[aPos.nNode.GetIndex() + 1]->GetTextNode(); + } + else + { + pTextNd = aPos.nNode.GetNode().GetTextNode(); + } if( pTextNd && pTextNd->HasSwAttrSet() ) pTextNd->ResetAllAttr(); @@ -903,6 +913,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) lcl_ReAnchorAtContentFlyFrames(*rDoc.GetSpzFrameFormats(), aPos, nOldIdx); pTextNd = aPos.nNode.GetNode().GetTextNode(); } + assert(pTextNd); // else where does m_aEndStr come from? if( pTextNd ) { OUString const ins( pTextNd->InsertText(*m_aEndStr, aPos.nContent, commit 8ec8da5638ab465e69900a08067ad496bcb5d3d5 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Jul 28 19:03:24 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed Jul 29 10:34:15 2020 +0200 tdf#134250 sw_redlinehide: fix copy non-empty node before non-textnode The problem in CopyImplImpl() is that pCopyPam's end position was updated to index 0 but text was copied into the node, which is thus not covered by pCopyPam and thus also not by SwUndoInserts. Then SwUndoInserts::UndoImpl() doesn't delete the bookmarks in the end node and the bookmark positions cause ~SwIndexReg asserts. Change-Id: I4cc03e846eae4cabd9eb4346a98c1e5c2866050d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99643 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index a8c427678c2d..00a850707be6 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -5064,7 +5064,14 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo if( rPos.nNode != aInsPos ) { pCopyPam->GetMark()->nNode = aInsPos; - pCopyPam->GetMark()->nContent.Assign(pCopyPam->GetContentNode(false), 0); + if (aInsPos < rPos.nNode) + { // tdf#134250 decremented in (pEndTextNd && !pDestTextNd) above + pCopyPam->GetContentNode(false)->MakeEndIndex(&pCopyPam->GetMark()->nContent); + } + else // incremented in (!pSttTextNd && pDestTextNd) above + { + pCopyPam->GetMark()->nContent.Assign(pCopyPam->GetContentNode(false), 0); + } rPos = *pCopyPam->GetMark(); } else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits