From 21b1dd42e9a817ae9b68e9e13ea57ce2491940c6 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 21 Apr 2023 11:30:43 -0400 Subject: tdf#154956 sw: delete bookmarks at end if whole node is selected Exposed by LO 7.2.2 commit 4bf04dea9afb30a9395e80b07a81d1908937ee8b Author: Michael Stahl on Fri Aug 27 14:38:18 2021 +0200 tdf#128106 sw: copy bookmarks at start if whole node is copied Change-Id: I9205463f9beb3704eeb63fe7556103230ba7283d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150772 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Michael Stahl --- sw/source/core/doc/docbm.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'sw/source/core/doc/docbm.cxx') diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index e047b2d1e319..ab5e544c2358 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -197,10 +197,17 @@ namespace bool lcl_Lower( const SwPosition& rPos, const SwNode& rNdIdx, std::optional oContentIdx ) { - return rPos.GetNode() < rNdIdx - || ( oContentIdx.has_value() - && rPos.GetNode() == rNdIdx - && rPos.GetContentIndex() < *oContentIdx ); + if (rPos.GetNode() < rNdIdx) + return true; + + if (rPos.GetNode() != rNdIdx || !oContentIdx) + return false; + + if (rPos.GetContentIndex() < *oContentIdx) + return true; + + // paragraph end selected? + return rNdIdx.IsTextNode() && *oContentIdx == rNdIdx.GetTextNode()->Len(); } bool lcl_MarkOrderingByStart(const ::sw::mark::MarkBase *const pFirst, -- cgit