[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Fri Jul 21 21:28:48 UTC 2017


 sw/source/core/doc/DocumentContentOperationsManager.cxx |   18 +++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 62f4151683cc6bde8db61820aa581ad9073b0841
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 21 23:01:37 2017 +0200

    sw: it looks like MoveRange() is never called with
    
    ... Undo enabled; let's try if somebody finds a way and remove this
    later if not.
    
    Change-Id: I9bad32342b129743ecfecb26901857cc4c79a89d

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 7df812d1cdd5..1d56dc7bd004 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1666,8 +1666,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons
         // Special case for handling an area with several nodes,
         // or a single node that is not a TextNode
         OSL_ENSURE( &m_rDoc == pDoc, " invalid copy branch!" );
-        OSL_FAIL("mst: i thought this could be dead code;"
-                "please tell me what you did to get here!");
+        assert(!"mst: this is assumed to be dead code");
         pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore);
 
         // Then copy the area to the underlying document area
@@ -2084,6 +2083,8 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
     pTNd = aSavePam.GetNode().GetTextNode();
     if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
     {
+        assert(!"mst: this is assumed to be dead code");
+
         // correct the SavePam's Content first
         if( bNullContent )
         {
commit 850795942b3e168cab8ce88b4f2b421945ff29ca
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 21 22:55:51 2017 +0200

    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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 57204ff80b5a..7df812d1cdd5 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2033,12 +2033,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,


More information about the Libreoffice-commits mailing list