sw/qa/extras/uiwriter/uiwriter.cxx | 22 ++++++++++++++++++++++ sw/source/core/undo/undel.cxx | 25 ++++++++++++++----------- 2 files changed, 36 insertions(+), 11 deletions(-)
New commits: commit e0b910d3296bd6338f1c3fd67ed97af70b60264a Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Jul 23 12:05:44 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Mon Jul 27 11:15:35 2020 +0200 sw_redlinehide: fix "delete of insert redline" Don't delete frames on start node in SwUndoDelete::UndoImpl; happens on SwUiWriterTest::testTdf83260(). (regression from ad0351b84926075297fb74abbe9b31a0455782af) Change-Id: I271d8bcbe4ab266e9e922e144450f05a24d183cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99410 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 02cf3597baf1..45361b4762d9 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1640,14 +1640,36 @@ void SwUiWriterTest::testTdf83260() { rUndoManager.Undo(); } + // check that every text node has a layout frame + for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + { + if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode()) + { + CPPUNIT_ASSERT(pNode->getLayoutFrame(nullptr, nullptr, nullptr)); + } + } for (auto i = nActions; 0 < i; --i) { rUndoManager.Redo(); } + for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + { + if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode()) + { + CPPUNIT_ASSERT(pNode->getLayoutFrame(nullptr, nullptr, nullptr)); + } + } for (auto i = nActions; 0 < i; --i) { rUndoManager.Undo(); } + for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + { + if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode()) + { + CPPUNIT_ASSERT(pNode->getLayoutFrame(nullptr, nullptr, nullptr)); + } + } } void SwUiWriterTest::testTdf130274() diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index cc001373cc37..9a525eb19cbd 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -1058,19 +1058,22 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) if (m_bDisableMakeFrames) // tdf#132944 { assert(!m_bDelFullPara); - SwTextNode *const pEndNode(aIdx.GetNodes()[m_nEndNode]->GetTextNode()); - SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode); - for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next()) + if (m_nSttNode != m_nEndNode) // never delete start node's frame! { - o3tl::sorted_vector<SwRootFrame *> layouts; - if (pFrame->getRootFrame()->IsHideRedlines()) - { - assert(pFrame->GetTextNodeFirst() == pEndNode); // can't be merged with previous - layouts.insert(pFrame->getRootFrame()); - } - for (SwRootFrame const*const pLayout : layouts) + SwTextNode *const pEndNode(aIdx.GetNodes()[m_nEndNode]->GetTextNode()); + SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode); + for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next()) { - pEndNode->DelFrames(pLayout); // SwUndoRedlineDelete will create it + o3tl::sorted_vector<SwRootFrame *> layouts; + if (pFrame->getRootFrame()->IsHideRedlines()) + { + assert(pFrame->GetTextNodeFirst() == pEndNode); // can't be merged with previous + layouts.insert(pFrame->getRootFrame()); + } + for (SwRootFrame const*const pLayout : layouts) + { + pEndNode->DelFrames(pLayout); // SwUndoRedlineDelete will create it + } } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits