From b78bcc2eb2b64b3d4c89d6641baed6b1eb6c9492 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Sat, 1 Jun 2024 11:52:05 -0400 Subject: [PATCH] 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 -- 2.39.5