summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-14 16:52:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-17 10:20:38 +0200
commitbb4ebb8bd143f641577fef69276da8dff62b197c (patch)
tree29f12d96e5fc7fac7d3619a6f3e732d7c589b1de
parent00c9b04028e5e2ed838313389f74c61b09caee2b (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/+/100753 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.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 3e0f8b16c254..6d6f241e7b2c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2003,7 +2003,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())
@@ -2094,6 +2094,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
@@ -2241,10 +2242,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);
}
}