commit b8888eef37af909d92dcc83912c04b14a300b4ec
Author: Juergen Spitzmueller <[email protected]>
Date: Fri Jul 18 18:11:43 2025 +0200
Fix marking of broken xrefs
---
src/insets/InsetRef.cpp | 22 +++++++++++++---------
src/insets/InsetRef.h | 2 +-
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index ac0e3b9ac2..6c3efbb84c 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -1023,22 +1023,26 @@ InsetRef::type_info const InsetRef::types[] = {
docstring InsetRef::getTOCString() const
{
broken_ = false;
- for (auto const & label : getLabels()) {
- broken_ &= isBroken(label, active_);
- }
+ for (auto const & label : getLabels())
+ broken_ &= isBroken(label) && active_;
+
return (broken_ ? _("BROKEN: ") : docstring()) + toc_string_;
}
-bool InsetRef::isBroken(docstring const & label, bool const preset) const
+bool InsetRef::isBroken(docstring const & label) const
{
FileName fn = getExternalFileName(label);
- if (fn.empty() || !fn.exists())
- return !buffer().activeLabel(label) && preset;
+ if (fn.empty() || !fn.exists()) {
+ if (buffer().insetLabel(label))
+ return !buffer().activeLabel(label);
+ else
+ return true;
+ }
Buffer const * buf = theBufferList().getBuffer(fn);
- if (buf)
- return !buf->activeLabel(label) && preset;
- return preset;
+ if (buf && buf->insetLabel(label))
+ return !buf->activeLabel(label);
+ return true;
}
diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h
index 5050ac708d..c08882fa05 100644
--- a/src/insets/InsetRef.h
+++ b/src/insets/InsetRef.h
@@ -138,7 +138,7 @@ private:
///
std::vector<docstring> getLabels() const { return
support::getVectorFromString(getParam("reference")); }
///
- bool isBroken(docstring const & label, bool const preset = false) const;
+ bool isBroken(docstring const & label) const;
///
mutable docstring screen_label_;
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs