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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 10 08:47:32 UTC 2020


 sw/source/core/undo/undobj.cxx |    8 ++++++--
 sw/source/core/undo/untblk.cxx |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit f9fb86408e6e06c262332be26674305ae5c05bb7
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Jun 9 16:12:04 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Jun 10 10:46:59 2020 +0200

    tdf#132597 sw: fix inconsistent handling of ExcludeFlyAtStartEnd
    
    IsDestroyFrameAnchoredAtChar() checks the position but the only caller,
    SwUndoInserts::UndoImpl(), really wants to exclude the entire nodes,
    see IsCreateUndoForNewFly().
    
    (regression from 28b77c89dfcafae82cf2a6d85731b643ff9290e5)
    
    Change-Id: I763ad3b7d82af03f6910dcf34315f793d090c62e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95952
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 0ba193fbc65c..85b9867dd3fc 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1563,10 +1563,15 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
         return (rStart < rAnchorPos) && (rAnchorPos < rEnd);
     }
 
+    if (nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
+    {   // exclude selection start and end node
+        return (rAnchorPos.nNode < rEnd.nNode)
+            && (rStart.nNode < rAnchorPos.nNode);
+    }
+
     // in general, exclude the start and end position
     return ((rStart < rAnchorPos)
             || (rStart == rAnchorPos
-                && !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
                 // special case: fully deleted node
                 && ((rStart.nNode != rEnd.nNode && rStart.nContent == 0
                         // but not if the selection is backspace/delete!
@@ -1574,7 +1579,6 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
                     || (IsAtStartOfSection(rAnchorPos) && IsAtEndOfSection(rEnd)))))
         && ((rAnchorPos < rEnd)
             || (rAnchorPos == rEnd
-                && !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
                 // special case: fully deleted node
                 && ((rEnd.nNode != rStart.nNode && rEnd.nContent == rEnd.nNode.GetNode().GetTextNode()->Len()
                         && IsNotBackspaceHeuristic(rStart, rEnd))
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index a7713bc036db..2a4b489d1e29 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -169,7 +169,7 @@ bool SwUndoInserts::IsCreateUndoForNewFly(SwFormatAnchor const& rAnchor,
     assert(nStartNode <= nEndNode);
 
     // check all at-char flys at the start/end nodes:
-    // ExcludeAtCharFlyAtStartEnd will exclude them!
+    // ExcludeFlyAtStartEnd will exclude them!
     SwPosition const*const pAnchorPos = rAnchor.GetContentAnchor();
     return pAnchorPos != nullptr
         && (   rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA


More information about the Libreoffice-commits mailing list