commit b78bcc2eb2b64b3d4c89d6641baed6b1eb6c9492
Author: Richard Kimberly Heck <rikih...@lyx.org>
Date:   Sat Jun 1 11:52:05 2024 -0400

    Fix bug #12981
    
    (cherry picked from commit 61181a39778ed5bcd7849ab388c402ab3f88d5cd)
---
 src/insets/InsetText.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 73813d9ee3..2879746ee8 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -1205,10 +1205,14 @@ void InsetText::iterateForToc(DocIterator const & cdit, 
bool output_active,
                InsetArgument const * arginset = nullptr;
                for (auto const & elem : par.insetList()) {
                        dit.pos() = elem.pos;
-                       elem.inset->addToToc(dit, doing_output, utype, backend);
-                       if (InsetArgument const * x = 
elem.inset->asInsetArgument())
-                               if (x->isTocCaption())
-                                       arginset = x;
+                       bool const being_output = doing_output &&
+                               !par.lookupChange(elem.pos).deleted();
+                       if (being_output) {
+                               elem.inset->addToToc(dit, being_output, utype, 
backend);
+                               if (InsetArgument const * x = 
elem.inset->asInsetArgument())
+                                       if (x->isTocCaption())
+                                               arginset = x;
+                       }
                }
 
                // End custom AddToToc in paragraph layouts
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to