sw/source/core/undo/undobj.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit 12acdce71dd6b6af2c52ba8fa3248d3166418543 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Jun 8 17:34:32 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jun 8 21:05:37 2022 +0200 (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.st...@allotropia.de> 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()) {