Skip to content

Commit

Permalink
fix #3329
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Oct 15, 2023
1 parent 33dc30f commit 557763d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/latexdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2367,7 +2367,7 @@ void LatexDocuments::removeDocs(QStringList removeIncludes)
* \param filenames
* \return true if newly loaded files contains packages
*/
bool LatexDocuments::addDocsToLoad(QStringList filenames, LatexDocument *parentDocument)
bool LatexDocuments::addDocsToLoad(QStringList filenames, LatexDocument *parentDocument,bool isHigherLevel)
{
auto *conf=dynamic_cast<ConfigManager *>(ConfigManagerInterface::getInstance());
bool newPackagesFound=false;
Expand All @@ -2393,8 +2393,12 @@ bool LatexDocuments::addDocsToLoad(QStringList filenames, LatexDocument *parentD
doc->lp->append(elem->ltxCommands);
}
}
doc->setMasterDocument(parentDocument,false);
parentDocument->addChild(doc);
if(!isHigherLevel){
// child document is added
// don't run if actually a root document is added, e.g. % texroot=...
doc->setMasterDocument(parentDocument,false);
parentDocument->addChild(doc);
}
doc->patchStructure(0,-1);
doc->lp->append(doc->ltxCommands);
docForUpdate=doc;
Expand Down Expand Up @@ -2523,7 +2527,7 @@ void LatexDocument::parseMagicComment(const QString &name, const QString &val, S
dc->childDocs.insert(this);
setMasterDocument(dc);
} else {
parent->addDocsToLoad(QStringList(fname),this);
parent->addDocsToLoad(QStringList(fname),this,true);
}
se->valid = true;
} else if (lowerName == "encoding") {
Expand Down
2 changes: 1 addition & 1 deletion src/latexdocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class LatexDocuments: public QObject


QHash<QString, LatexPackage> cachedPackages;
bool addDocsToLoad(QStringList filenames,LatexDocument *parentDocument);
bool addDocsToLoad(QStringList filenames, LatexDocument *parentDocument, bool isHigherLevel=false);
void removeDocs(QStringList removeIncludes);
void hideDocInEditor(LatexEditorView *edView);
QString findPackageByCommand(const QString command);
Expand Down

0 comments on commit 557763d

Please sign in to comment.