sw/source/core/undo/undobj.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 0d97bcee3505cf70828aaf4f053c079127b7f94d Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Thu Jun 11 15:26:27 2020 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri Jun 12 01:13:17 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.st...@cib.de> (cherry picked from commit cc4b5091e739116a7ec83513fa1cd856f0130330) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96147 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index e6a6d5a509d7..eb42e7dfbc0c 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1532,6 +1532,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) { @@ -1573,13 +1586,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, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits