From: Richard Kimberly Heck Date: Sat, 1 Jun 2024 15:52:05 +0000 (-0400) Subject: Fix bug #12981 X-Git-Tag: 2.4.1~77 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b78bcc2eb2b64b3d4c89d6641baed6b1eb6c9492;p=lyx.git Fix bug #12981 (cherry picked from commit 61181a39778ed5bcd7849ab388c402ab3f88d5cd) --- 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