From ab63e72fcb7ff4db54e5bb4b1277035b002bb4f1 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 24 Nov 2017 15:34:25 -0500 Subject: [PATCH] Minor code re-organization --- src/insets/InsetCollapsible.cpp | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp index c429c51b41..32c78752d2 100644 --- a/src/insets/InsetCollapsible.cpp +++ b/src/insets/InsetCollapsible.cpp @@ -672,23 +672,23 @@ void InsetCollapsible::addToToc(DocIterator const & cpit, bool output_active, { bool doing_output = output_active && producesOutput(); InsetLayout const & layout = getLayout(); - if (layout.addToToc()) { - TocBuilder & b = backend.builder(layout.tocType()); - // Cursor inside the inset - DocIterator pit = cpit; - pit.push_back(CursorSlice(const_cast(*this))); - docstring const label = getLabel(); - b.pushItem(pit, label + (label.empty() ? "" : ": "), output_active); - // Proceed with the rest of the inset. - InsetText::addToToc(cpit, doing_output, utype, backend); - if (layout.isTocCaption()) { - docstring str; - text().forOutliner(str, TOC_ENTRY_LENGTH); - b.argumentItem(str); - } - b.pop(); - } else - InsetText::addToToc(cpit, doing_output, utype, backend); + if (!layout.addToToc()) + return InsetText::addToToc(cpit, doing_output, utype, backend); + + TocBuilder & b = backend.builder(layout.tocType()); + // Cursor inside the inset + DocIterator pit = cpit; + pit.push_back(CursorSlice(const_cast(*this))); + docstring const label = getLabel(); + b.pushItem(pit, label + (label.empty() ? "" : ": "), output_active); + // Proceed with the rest of the inset. + InsetText::addToToc(cpit, doing_output, utype, backend); + if (layout.isTocCaption()) { + docstring str; + text().forOutliner(str, TOC_ENTRY_LENGTH); + b.argumentItem(str); + } + b.pop(); } -- 2.39.2