diff options
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 585c8c81afc2..32f7da7e99de 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2037,12 +2037,19 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, // Put back the Pam by one "content"; so that it's always outside of // the manipulated range. - // If there's no content anymore, set it to the StartNode (that's - // always there). - const bool bNullContent = !aSavePam.Move( fnMoveBackward, GoInContent ); + // tdf#99692 don't Move() back if that would end up in another node + // because moving backward is not necessarily the inverse of forward then. + const bool bNullContent = aSavePam.GetPoint()->nContent == 0; if( bNullContent ) { aSavePam.GetPoint()->nNode--; + aSavePam.GetPoint()->nContent.Assign(aSavePam.GetContentNode(), 0); + } + else + { + bool const success(aSavePam.Move(fnMoveBackward, GoInContent)); + assert(success); + (void) success; } // Copy all Bookmarks that are within the Move range into an array, |