]> git.lyx.org Git - lyx.git/commitdiff
Fix bug #12981
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sat, 1 Jun 2024 15:52:05 +0000 (11:52 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sat, 1 Jun 2024 15:59:39 +0000 (11:59 -0400)
(cherry picked from commit 61181a39778ed5bcd7849ab388c402ab3f88d5cd)

src/insets/InsetText.cpp

index 73813d9ee3aae825884b57eaa25517dd81b132ae..2879746ee876119c716fabc450cb3bc6cb6c1140 100644 (file)
@@ -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