summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-07-21 22:55:51 +0200
committerAndras Timar <andras.timar@collabora.com>2017-07-31 12:03:55 +0200
commitec5da615a8695caebe0370fa2de3b29134b6a379 (patch)
tree049e16475ee61e3a1cf9d7a1717f712744022c0a
parent86dd9832353d3b904348d8a4f68a2bfac809ca43 (diff)
tdf#99692 sw: fix bookmark positions in tables at start of redlines
The code assumes that if it can move the cursor backward in line 2038, that move can be "inverted" by moving the cursor forward after the content has been moved - but if the cursor moved back a node, and the moved content does not start with a SwTextNode, the cursor will move forward skipping over the non-text nodes, so offsets in the aSaveBkmks (and aSaveRedl, presumably) are going to be wrong. Just don't use Move() if it leaves the current node. Change-Id: I95278a10c14aeba9f76558486bb2712f6726dbcb (cherry picked from commit 850795942b3e168cab8ce88b4f2b421945ff29ca) Reviewed-on: https://gerrit.libreoffice.org/40419 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit be2a7025e5b62e9dab73886436ee52d5330ae381)
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index a64433f399c3..d8b4dd197690 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2038,12 +2038,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,