[LyX/2.5.x] Load externally referred buffers and initialize their labels

Juergen Spitzmueller <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 7ff8fa2da950f0c58e8fa9b48a72173d59921fbf
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Apr 11 12:07:46 2026 +0200

    Load externally referred buffers and initialize their labels
    
    (cherry picked from commit 5f7a66e3efe65363afd400e178961631510effbd)
---
 src/Buffer.cpp | 10 +++++++++-
 status.25x     |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index f12cb3957e..2ea6125e06 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2560,8 +2560,16 @@ void Buffer::registerExternalRefs(FileName fn) const
 
 	vector<FileName>::const_iterator temp =
 		find(d->external_xrefed_files_.begin(), d->external_xrefed_files_.end(), fn);
-	if (temp == d->external_xrefed_files_.end())
+	if (temp == d->external_xrefed_files_.end()) {
 		d->external_xrefed_files_.push_back(fn);
+		// we also need to load these files in the background
+		// and update their buffer to get valid ref insets
+		if (!theBufferList().getBuffer(fn)) {
+			Buffer * xb = checkAndLoadLyXFile(fn, true);
+			if (xb)
+				xb->updateBuffer();
+		}
+	}
 }
 
 
diff --git a/status.25x b/status.25x
index 7ee248761a..41291a8332 100644
--- a/status.25x
+++ b/status.25x
@@ -49,6 +49,7 @@ What's new
 
 * USER INTERFACE
 
+- Load externally referred buffers and initialize their labels.
 
 
 * INTERNALS
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.