]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
Fixing bugs 1844,1845: doc settings don't stick
[lyx.git] / src / buffer.C
index 72322b07a43649d9c173e5da2db2cc596c81ff20..f33c70bbf6dcb629e2bf0dc2b853095f42864342 100644 (file)
@@ -13,6 +13,7 @@
 #include "buffer.h"
 
 #include "author.h"
+#include "BranchList.h"
 #include "buffer_funcs.h"
 #include "bufferlist.h"
 #include "bufferparams.h"
@@ -137,7 +138,7 @@ extern BufferList bufferlist;
 
 namespace {
 
-int const LYX_FORMAT = 240;
+int const LYX_FORMAT = 241;
 
 } // namespace anon
 
@@ -395,6 +396,20 @@ int Buffer::readHeader(LyXLex & lex)
        int line = -1;
        int begin_header_line = -1;
 
+       // Initialize parameters that may be/go lacking in header:
+       params().branchlist().clear();
+       params().options.erase();
+       params().float_placement.erase();
+       params().paperwidth.erase();
+       params().paperheight.erase();
+       params().leftmargin.erase();
+       params().rightmargin.erase();
+       params().topmargin.erase();
+       params().bottommargin.erase();
+       params().headheight.erase();
+       params().headsep.erase();
+       params().footskip.erase();
+
        while (lex.isOK()) {
                lex.next();
                string const token = lex.getString();
@@ -482,7 +497,7 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
        // insert the string, don't insert doublespace
        bool space_inserted = true;
        for (string::const_iterator cit = str.begin();
-           cit != str.end(); ++cit) { 
+           cit != str.end(); ++cit) {
                Paragraph & par = pars[pit];
                if (*cit == '\n') {
                        if (autobreakrows && (!par.empty() || par.allowEmpty())) {
@@ -857,6 +872,8 @@ void Buffer::makeLaTeXFile(ostream & os,
                if (!original_path.empty()) {
                        string inputpath = os::external_path(original_path);
                        subst(inputpath, "~", "\\string~");
+                       if (inputpath.find(' ') != string::npos)
+                               inputpath = '"' + inputpath + '"';
                        os << "\\makeatletter\n"
                            << "\\def\\input@path{{"
                            << inputpath << "/}}\n"