summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-06-09 16:12:04 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-06-10 10:46:59 +0200
commitf9fb86408e6e06c262332be26674305ae5c05bb7 (patch)
tree371379db509cdeed3c89af797f5d4d8109d7ae0e
parenta938ead6639777337267f613cb0dea9c326c15b0 (diff)
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@cib.de>
-rw-r--r--sw/source/core/undo/undobj.cxx8
-rw-r--r--sw/source/core/undo/untblk.cxx2
2 files changed, 7 insertions, 3 deletions
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