tdf#134404 sw: another subtlety with start/end of section (at-para flys)
fix this problem by comparing the start/end of the selection instead of
the anchor position, which always has an index of 0:
1. new document with image anchored to paragraph
2. insert one letter
3. press Enter
4. Backspace -> Image gone
(regression from cc4b5091e739116a7ec83513fa1cd856f0130330)
Change-Id: I1219a9f58ce19ea88d697c90c862fe9005318177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97511
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index b2609a2..f0ed413 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1650,14 +1650,14 @@ bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos,
&& ((rStart.nNode != rEnd.nNode && rStart.nContent == 0
// but not if the selection is backspace/delete!
&& IsNotBackspaceHeuristic(rStart, rEnd))
|| (IsAtStartOfSection(rAnchorPos) && IsAtEndOfSection2(rEnd)))))
|| (IsAtStartOfSection2(rStart) && IsAtEndOfSection2(rEnd)))))
&& ((rAnchorPos.nNode < rEnd.nNode)
|| (rAnchorPos.nNode == rEnd.nNode
&& !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
// special case: fully deleted node
&& ((rEnd.nNode != rStart.nNode && rEnd.nContent == rEnd.nNode.GetNode().GetTextNode()->Len()
&& IsNotBackspaceHeuristic(rStart, rEnd))
|| (IsAtEndOfSection(rAnchorPos) && IsAtStartOfSection2(rStart)))));
|| (IsAtEndOfSection2(rEnd) && IsAtStartOfSection2(rStart)))));
}
bool IsFlySelectedByCursor(SwDoc const & rDoc,