]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Update tex2lyx tests
[lyx.git] / src / Buffer.cpp
index 83a82f84c85bffb60eaf3358765214dcf6dacdc1..8ca74103a232a48705cd0814cdb14ab1dba8a768 100644 (file)
@@ -562,13 +562,13 @@ Buffer::~Buffer()
 }
 
 
-Buffer * Buffer::cloneFromMaster() const
+Buffer * Buffer::cloneWithChildren() const
 {
        BufferMap bufmap;
        cloned_buffers.push_back(new CloneList);
        CloneList * clones = cloned_buffers.back();
 
-       masterBuffer()->cloneWithChildren(bufmap, clones);
+       cloneWithChildren(bufmap, clones);
 
        // make sure we got cloned
        BufferMap::const_iterator bit = bufmap.find(this);
@@ -888,6 +888,7 @@ int Buffer::readHeader(Lexer & lex)
        params().options.erase();
        params().master.erase();
        params().float_placement.erase();
+       params().float_alignment.erase();
        params().paperwidth.erase();
        params().paperheight.erase();
        params().leftmargin.erase();
@@ -1040,6 +1041,10 @@ bool Buffer::readDocument(Lexer & lex)
                                                << absFileName()
                                                << ") does not include "
                                                "this document. Ignoring the master assignment.");
+                               // If the master has just been created, un-hide it (#11162)
+                               if (!master->fileName().exists())
+                                       lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH,
+                                                                 master->absFileName()));
                        }
                }
        }
@@ -1897,8 +1902,7 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
                                            "file path name."),
                                          inputpath, uncodable_glyphs));
                        } else {
-                               string docdir =
-                                       latex_path(original_path);
+                               string docdir = os::latex_path(original_path);
                                if (contains(docdir, '#')) {
                                        docdir = subst(docdir, "#", "\\#");
                                        os << "\\catcode`\\#=11"
@@ -1909,9 +1913,20 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
                                        os << "\\catcode`\\%=11"
                                              "\\def\\%{%}\\catcode`\\%=14\n";
                                }
+                               bool const detokenize = !isAscii(from_utf8(docdir));
+                               bool const quote = contains(docdir, ' ');
                                os << "\\makeatletter\n"
-                                  << "\\def\\input@path{{"
-                                  << docdir << "}}\n"
+                                  << "\\def\\input@path{{";
+                               if (detokenize)
+                                       os << "\\detokenize{";
+                               if (quote)
+                                       os << "\"";
+                               os << docdir;
+                               if (quote)
+                                       os << "\"";
+                               if (detokenize)
+                                       os << "}";
+                               os << "}}\n"
                                   << "\\makeatother\n";
                        }
                }
@@ -2405,7 +2420,8 @@ BiblioInfo const & Buffer::bibInfo() const
 }
 
 
-void Buffer::registerBibfiles(FileNamePairList const & bf) const {
+void Buffer::registerBibfiles(FileNamePairList const & bf) const
+{
        // We register the bib files in the master buffer,
        // if there is one, but also in every single buffer,
        // in case a child is compiled alone.
@@ -2453,17 +2469,17 @@ void Buffer::checkIfBibInfoCacheIsValid() const
 }
 
 
-void Buffer::reloadBibInfoCache() const
+void Buffer::reloadBibInfoCache(bool const force) const
 {
        // use the master's cache
        Buffer const * const tmp = masterBuffer();
        if (tmp != this) {
-               tmp->reloadBibInfoCache();
+               tmp->reloadBibInfoCache(force);
                return;
        }
 
        checkIfBibInfoCacheIsValid();
-       if (d->bibinfo_cache_valid_)
+       if (d->bibinfo_cache_valid_ && !force)
                return;
 
        d->bibinfo_.clear();