summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-06-08 17:34:32 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-06-21 23:40:25 +0200
commitc6a2033221c86166a2226023f34314eb59380fa2 (patch)
tree29acd7f849a8141ebf4b749526c0c31d613c7d49
parenttdf#133957 sw: don't delete flys on Backspace/Delete keys (diff)
downloadcore-c6a2033221c86166a2226023f34314eb59380fa2.tar.gz
core-c6a2033221c86166a2226023f34314eb59380fa2.zip
(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> (cherry picked from commit 054c248127c78521b4a4e7aacd8936bd54259996) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136218 Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-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 3fe7f107f052..d611cb4a496b 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -981,10 +981,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())
{