diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-11 13:16:10 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-12-18 22:30:15 +0100 |
commit | 7610df6b983948a78b8b418d19e4fcde8313e33c (patch) | |
tree | 6092ee50a4f451f557252309c0ad23eb4912442c /sw | |
parent | da68e7c9442770f319676bb1cffab724b463ab19 (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
(cherry picked from commit bba571995d30967a74d67b7f2f3f4b65491a248a)
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 8a97bcba42d5..ea7a0d5ba0c7 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) |