diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-07-28 19:12:19 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-07-29 10:34:24 +0200 |
commit | 27613259990d39d34b036b3d717d3ceaf5c15e65 (patch) | |
tree | 4eee4e54c3e23b41540d0a60155a782806cb8c22 | |
parent | 8ec8da5638ab465e69900a08067ad496bcb5d3d5 (diff) |
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.stahl@cib.de>
-rw-r--r-- | sw/source/core/undo/undel.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
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, |