summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docbm.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-01-12 16:57:48 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-01-13 07:13:39 +0000
commit04d50fa627faabb9211bd9fa9eb134599fb01982 (patch)
tree3be8aa1b62b87aa52ac0635345cb3fd5cc06aafd /sw/source/core/doc/docbm.cxx
parent60be9811555b935d6860157ebf26fac6b48327ac (diff)
sw: rename getBookmarkFor() to getInnerBookmarkFor()
Because otherwise it's quite confusing that we have a For() and an At() variant as well, and it would be less clear what happens in For() when there are multiple matches. Also improve getInnerBookmarkFor() a tiny little, so we process the first hit only once. Suggested at <https://gerrit.libreoffice.org/c/core/+/145348/1#message-286262286f234823b390e8f962e3ba11f5fa71b2>. Change-Id: If068f93e6934c9fc042760c03aac866fe5b50bd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145412 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/doc/docbm.cxx')
-rw-r--r--sw/source/core/doc/docbm.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 7152c2a2314a..468b5a2e3b11 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1437,7 +1437,7 @@ namespace sw::mark
return dynamic_cast<IFieldmark*>(pFieldmark);
}
- IMark* MarkManager::getBookmarkFor(const SwPosition& rPos) const
+ IMark* MarkManager::getInnerBookmarkFor(const SwPosition& rPos) const
{
auto it = std::find_if(m_vBookmarks.begin(), m_vBookmarks.end(),
[&rPos](const sw::mark::MarkBase* pMark)
@@ -1447,6 +1447,10 @@ namespace sw::mark
return nullptr;
}
sw::mark::IMark* pBookmark = *it;
+
+ // See if any bookmarks after the first hit are closer to rPos.
+ ++it;
+
for (; it != m_vBookmarks.end() && (*it)->GetMarkStart() <= rPos; ++it)
{
// Find the innermost bookmark.