From: Enrico Forestieri Date: Mon, 22 Jun 2009 05:09:01 +0000 (+0000) Subject: Fix bug #6020: Reverse DVI/PDF search fails with child documents. X-Git-Tag: 2.0.0~6237 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d4f00122eb4b20e5d5128e771f2f524dd70dd6f7;p=features.git Fix bug #6020: Reverse DVI/PDF search fails with child documents. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30214 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferList.cpp b/src/BufferList.cpp index 4f6c848452..c83d3f20e2 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -327,9 +327,26 @@ Buffer * BufferList::getBufferFromTmp(string const & s) { BufferStorage::iterator it = bstore.begin(); BufferStorage::iterator end = bstore.end(); - for (; it < end; ++it) - if (prefixIs(s, (*it)->temppath())) - return *it; + for (; it < end; ++it) { + if (prefixIs(s, (*it)->temppath())) { + // check whether the filename matches the master + string const master_name = changeExtension(onlyFilename( + (*it)->absFileName()), ".tex"); + if (suffixIs(s, master_name)) + return *it; + // if not, try with the children + vector clist = (*it)->getChildren(); + vector::const_iterator cit = clist.begin(); + vector::const_iterator cend = clist.end(); + for (; cit < cend; ++cit) { + string const mangled_child_name = DocFileName( + changeExtension((*cit)->absFileName(), + ".tex")).mangledFilename(); + if (suffixIs(s, mangled_child_name)) + return *cit; + } + } + } return 0; }