X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBranch.cpp;h=ad7cbc5cdc21fb6f83efc517a2be06a1842790b8;hb=c0adb03a7ae15cf6409ee3cb64f4cc91c24c052e;hp=d30e348da571f9ecc60a1e6163ad878cf93bc81b;hpb=819cf53c2254f17e9bb6c6b971904451cfaaae6d;p=lyx.git diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index d30e348da5..ad7cbc5cdc 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -190,6 +190,21 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd) // cur.forceBufferUpdate() is not enough buf->updateBuffer(); } + + // if branch exists in a descendant, update previews. + // TODO: only needed if "Show preview" is enabled in the included inset. + bool exists_in_desc = false; + for (auto const & it : buf->getDescendants()) { + if (it->params().branchlist().find(params_.branch)) + exists_in_desc = true; + } + if (exists_in_desc) { + // TODO: ideally we would only update the previews of the + // specific children that have this branch directly or + // in one of their descendants + buf->removePreviews(); + buf->updatePreviews(); + } break; } case LFUN_BRANCH_INVERT: @@ -292,8 +307,11 @@ bool InsetBranch::producesOutput() const void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const { - if (producesOutput()) - InsetText::latex(os, runparams); + if (producesOutput()) { + OutputParams rp = runparams; + rp.inbranch = true; + InsetText::latex(os, rp); + } } @@ -384,10 +402,10 @@ void InsetBranch::string2params(string const & in, InsetBranchParams & params) } -void InsetBranch::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetBranch::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { setLabel(params_.branch + (params_.inverted ? " (-)" : "")); - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); }