summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-14 16:52:23 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-08-27 16:44:08 +0200
commit04d2a330f7b9db6a8e2a340b119f474946b84d44 (patch)
treeb22e9bd3450a0e65adbdf94d5cb67096e051355a
parentdbbce6bf7f21fd8d72fa9b01a28a4ea0d7e2ccdc (diff)
tdf#132892 Revert "sw: paragraph-sign: erase metafields ... correctly"
This reverts commit b402d0112a0bb53221b847fa372bfa3f6390a0e2. Change-Id: I210d2fded01fb952d7384b78240e32d868b08575 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100795 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins (cherry picked from commit 13c3e22bcea72aa1b41e5891ff65647f7eeb02d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101152 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 6200eb040abd..37400645b2fc 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2002,7 +2002,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
{
CHECK_SWPHINTS_IF_FRM(this);
CHECK_SWPHINTS(pDest);
- const sal_Int32 nTextStartIdx = rStart.GetIndex();
+ sal_Int32 nTextStartIdx = rStart.GetIndex();
sal_Int32 nDestStart = rDestStart.GetIndex(); // remember old Pos
if (pDest->GetDoc()->IsClipBoard() && GetNum())
@@ -2093,6 +2093,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
// Fetch end only now, because copying into self updates the start index
// and all attributes
+ nTextStartIdx = rStart.GetIndex();
const sal_Int32 nEnd = nTextStartIdx + nLen;
// 2. copy attributes
@@ -2240,10 +2241,8 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
std::reverse(metaFieldRanges.begin(), metaFieldRanges.end());
for (const auto& pair : metaFieldRanges)
{
- const SwIndex aIdx(pDest, std::max<sal_Int32>(pair.first - nTextStartIdx, 0));
- const sal_Int32 nCount = pair.second - pair.first;
- if (nCount > 0)
- pDest->EraseText(aIdx, nCount);
+ const SwIndex aIdx(pDest, pair.first);
+ pDest->EraseText(aIdx, pair.second - pair.first);
}
}