[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 11 17:10:22 UTC 2020
sw/source/core/undo/undobj.cxx | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
New commits:
commit cc4b5091e739116a7ec83513fa1cd856f0130330
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jun 11 15:26:27 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Jun 11 19:09:41 2020 +0200
tdf#132744 sw: fix subtle difference when checking end of section
In a few places, such as CopyFlyInFlyImpl() and DelFlyInRange(),
the passed start/end positions aren't necessarily from a cursor but can
be section start/end nodes instead.
(regression from 971205dc2110c1c23ff1db1fc4041e2babf6fa9f)
Change-Id: I1fb24f1f9d027aa3685ac5a7459891cb8c2b9a41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96124
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 54c5181b43f4..2fb9a44da30b 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1536,6 +1536,19 @@ static bool IsAtStartOfSection(SwPosition const& rAnchorPos)
return node == rAnchorPos.nNode && rAnchorPos.nContent == 0;
}
+/// passed start / end position could be on section start / end node
+static bool IsAtEndOfSection2(SwPosition const& rPos)
+{
+ return rPos.nNode.GetNode().IsEndNode()
+ || IsAtEndOfSection(rPos);
+}
+
+static bool IsAtStartOfSection2(SwPosition const& rPos)
+{
+ return rPos.nNode.GetNode().IsStartNode()
+ || IsAtStartOfSection(rPos);
+}
+
static bool IsNotBackspaceHeuristic(
SwPosition const& rStart, SwPosition const& rEnd)
{
@@ -1577,13 +1590,13 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
&& ((rStart.nNode != rEnd.nNode && rStart.nContent == 0
// but not if the selection is backspace/delete!
&& IsNotBackspaceHeuristic(rStart, rEnd))
- || (IsAtStartOfSection(rAnchorPos) && IsAtEndOfSection(rEnd)))))
+ || (IsAtStartOfSection(rAnchorPos) && IsAtEndOfSection2(rEnd)))))
&& ((rAnchorPos < rEnd)
|| (rAnchorPos == rEnd
// special case: fully deleted node
&& ((rEnd.nNode != rStart.nNode && rEnd.nContent == rEnd.nNode.GetNode().GetTextNode()->Len()
&& IsNotBackspaceHeuristic(rStart, rEnd))
- || (IsAtEndOfSection(rAnchorPos) && IsAtStartOfSection(rStart)))));
+ || (IsAtEndOfSection(rAnchorPos) && IsAtStartOfSection2(rStart)))));
}
bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos,
More information about the Libreoffice-commits
mailing list