diff options
-rw-r--r-- | sw/source/core/text/itratr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/redlnitr.cxx | 30 |
2 files changed, 27 insertions, 5 deletions
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 3bd7075cb9ed..827a29e8538f 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -740,6 +740,8 @@ TextFrameIndex SwAttrIter::GetNextAttr() const if (redline.second.first) { assert(m_pMergedPara); + assert(redline.second.first->End()->nNode.GetIndex() <= m_pMergedPara->pLastNode->GetIndex() + || !redline.second.first->End()->nNode.GetNode().IsTextNode()); if (CanSkipOverRedline(*redline.second.first, nStartIndex, nEndIndex, m_nPosition == redline.first)) { // if current position is start of the redline, must skip! diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index e73a478ce737..0b92335a7e97 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -124,12 +124,32 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, } pTmp->SetRedlineMergeFlag(SwNode::Merge::Hidden); } - pNode = pEnd->nNode.GetNode().GetTextNode(); - assert(pNode); - nodes.push_back(pNode); - pNode->SetRedlineMergeFlag(SwNode::Merge::NonFirst); + // note: in DelLastPara() case, the end node is not actually merged + // and is likely a SwTableNode! + if (!pEnd->nNode.GetNode().IsTextNode()) + { + assert(pEnd->nNode != pStart->nNode); + // must set pNode too because it will mark the last node + pNode = nodes.back(); + assert(pNode == pNode->GetNodes()[pEnd->nNode.GetIndex() - 1]); + if (pNode != &rTextNode) + { // something might depend on last merged one being NonFirst? + pNode->SetRedlineMergeFlag(SwNode::Merge::NonFirst); + } + nLastEnd = pNode->Len(); + } + else + { + pNode = pEnd->nNode.GetNode().GetTextNode(); + nodes.push_back(pNode); + pNode->SetRedlineMergeFlag(SwNode::Merge::NonFirst); + nLastEnd = pEnd->nContent.GetIndex(); + } + } + else + { + nLastEnd = pEnd->nContent.GetIndex(); } - nLastEnd = pEnd->nContent.GetIndex(); } if (pNode == &rTextNode) { |