commit fc6fe6c513eb448ea56c303862299b1425cc8ea3
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Jul 26 14:16:18 2025 +0200

    Add way to request a additional buffer update from within a buffer update
    
    This is needed when counters have parent counters that are set
    later (subfigures)
---
 src/Buffer.cpp | 17 ++++++++++++++---
 src/Buffer.h   |  5 +++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 9111a7849d..bbf4dfe97b 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -366,6 +366,8 @@ public:
 
        ///
        mutable bool need_update;
+       /// do we need a second update pass?
+       mutable bool need_extra_update;
 
        ///
        bool is_closing;
@@ -458,7 +460,7 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, 
bool readonly_,
          internal_buffer(false), read_only(readonly_), 
file_fully_loaded(false),
          need_format_backup(false), ignore_parent(false), macro_lock(false),
          externally_modified_(false), bibinfo_cache_valid_(false), 
need_update(false),
-         is_closing(false)
+         need_extra_update(false), is_closing(false)
 {
        refreshFileMonitor();
        if (!cloned_buffer_) {
@@ -5081,6 +5083,12 @@ void Buffer::updateBuffer() const
 {
        updateBuffer(UpdateMaster, InternalUpdate);
        d->need_update = false;
+       if (d->need_extra_update) {
+               // an additional update cycle has been
+               // requested from within the cycle
+               updateBuffer(UpdateMaster, InternalUpdate);
+               d->need_extra_update = false;
+       }
 }
 
 
@@ -5473,9 +5481,12 @@ void Buffer::updateBuffer(ParIterator & parit, 
UpdateType utype, bool const dele
 }
 
 
-void Buffer::forceUpdate() const
+void Buffer::forceUpdate(bool const extra) const
 {
-       d->need_update = true;
+       if (extra)
+               d->need_extra_update = true;
+       else
+               d->need_update = true;
 }
 
 
diff --git a/src/Buffer.h b/src/Buffer.h
index 72ab79d158..c8dffc3cfc 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -773,8 +773,9 @@ public:
        void updateBuffer(UpdateScope scope, UpdateType utype) const;
        ///
        void updateBuffer(ParIterator & parit, UpdateType utype, bool const 
deleted = false) const;
-       /// Forces an updateBuffer() call
-       void forceUpdate() const;
+       /// Forces an updateBuffer() call. \p extra determines whether this
+       /// is an additional update request from within an updateBuffer() call
+       void forceUpdate(bool const extra = false) const;
        /// Do we need to call updateBuffer()?
        bool needUpdate() const;
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to