summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-06-08 17:34:32 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-06-10 13:08:48 +0200
commit054c248127c78521b4a4e7aacd8936bd54259996 (patch)
treef1499ed295d794bc13691657b2e35f530e9d1425 /sw
parent5192cd430e8cab0ed04f8c70c5194397455ac705 (diff)
(related: tdf#139514) sw: fix Undo of delete with at-para fly
Nonobviously, there are situations where the anchor node must be preserved and restored when it's not on the node that is being deleted. (probably regression from commit 91b2325808a75174f284c48c8b8afc118fad74e4) Change-Id: I39f09ddb631204c8ad522f9ec7068d235ca94ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135509 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 12acdce71dd6b6af2c52ba8fa3248d3166418543) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135518 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/undo/undobj.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 6cde5bed2f6a..c23aeba3ba51 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1003,10 +1003,14 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
// Moving the anchor?
else if (!((DelContentType::CheckNoCntnt|DelContentType::ExcludeFlyAtStartEnd)
& nDelContentType) &&
- // at least for calls from SwUndoDelete,
- // this should work - other Undos don't
- // remember the order of the cursor
- (rPoint.nNode.GetIndex() == pAPos->nNode.GetIndex())
+ // for SwUndoDelete: rPoint is the node that
+ // will be Joined - so anchor should be moved
+ // off it - but UndoImpl() split will insert
+ // new node *before* existing one so a no-op
+ // may need to be done here to add it to
+ // history for Undo.
+ (rPoint.nNode.GetIndex() == pAPos->nNode.GetIndex()
+ || pStt->nNode.GetIndex() == pAPos->nNode.GetIndex())
// Do not try to move the anchor to a table!
&& rMark.nNode.GetNode().IsTextNode())
{