diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-11 13:16:10 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-18 17:55:29 +0100 |
commit | bba571995d30967a74d67b7f2f3f4b65491a248a (patch) | |
tree | 4bac42650c68e86adf07762649b470a2c24a2b4c /sw | |
parent | c20308f1b919ca5ce61233068946e5fddb7eadb3 (diff) |
sw_redlinehide_4b: fix wrong nTFIndex in UpdateMergedParaForInsert()
The nTFIndex is used to insert into the merged string; the correct index
is at the position corresponding to itInsert in the extents array.
Once the itInsert is found, the nTFIndex is no longer used inside the
loop, so just stop updating it.
Change-Id: Idc073cc758bad42b0d8b44d15f0f8e732eeb2a25
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 16896aa94a98..888f8a75cbcf 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -840,7 +840,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, return TextFrameIndex(0); } OUStringBuffer text(rMerged.mergedText); - sal_Int32 nTFIndex(0); + sal_Int32 nTFIndex(0); // index used for insertion at the end sal_Int32 nInserted(0); bool bInserted(false); bool bFoundNode(false); @@ -922,10 +922,16 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged, } else if (rNode.GetIndex() < it->pNode->GetIndex() || bFoundNode) { - itInsert = it; + if (itInsert == rMerged.extents.end()) + { + itInsert = it; + } break; } - nTFIndex += it->nEnd - it->nStart; + if (itInsert == rMerged.extents.end()) + { + nTFIndex += it->nEnd - it->nStart; + } } // assert((bFoundNode || rMerged.extents.empty()) && "text node not found - why is it sending hints to us"); if (!bInserted) |