summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/txtedt.cxx
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-07-20 17:54:16 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-07-26 15:23:59 +0200
commit7974cea6c788e02d7c36573e2d10dcc51884f70e (patch)
treece649c3cb04a180029039d65085264c560f2cf3e /sw/source/core/txtnode/txtedt.cxx
parent5b1a8f39ee58fe5372eea18ce1ee99c95b11ba05 (diff)
tdf#150017 sw: Replace should not shorten bookmarks
If there is a bookmark on the text that is replaced, its end will be after the 1st character of the replacement text. This is very odd and it would be much better to put the end at the end of the replacement text, particularly if the end of the bookmark used to be at the end of the replaced text. Text attributes already work such that the attribute on the first character before the replace is expanded to the entire replacement text; this seems odd too but as it happens Word does the same thing, so this patch makes bookmarks consistent with attributes. Change-Id: I6a4b43c779c207a31edb02b416d50c30386c94c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137272 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/core/txtnode/txtedt.cxx')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 6d90143f59d4..7f0e0ea12edb 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1999,7 +1999,7 @@ void SwTextNode::ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
while( nI + nCnt < nTLen && nOff == pOffsets[ nI + nCnt ] )
++nCnt;
- Update( SwContentIndex( this, nMyOff ), nCnt );
+ Update(SwContentIndex(this, nMyOff), nCnt, UpdateMode::Default);
nMyOff = nOff;
//nMyOff -= nCnt;
nI += nCnt - 1;
@@ -2007,14 +2007,14 @@ void SwTextNode::ReplaceTextOnly( sal_Int32 nPos, sal_Int32 nLen,
else if( nOff > nMyOff )
{
// something is deleted
- Update( SwContentIndex( this, nMyOff+1 ), nOff - nMyOff, true );
+ Update(SwContentIndex(this, nMyOff + 1), nOff - nMyOff, UpdateMode::Negative);
nMyOff = nOff;
}
++nMyOff;
}
if( nMyOff < nLen )
// something is deleted at the end
- Update( SwContentIndex( this, nMyOff ), nLen - nMyOff, true );
+ Update(SwContentIndex(this, nMyOff), nLen - nMyOff, UpdateMode::Negative);
// notify the layout!
SwDelText aDelHint( nPos, nTLen );