]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.C
Fix bug 2404
[lyx.git] / src / buffer_funcs.C
index b4f4bf7bf7e2d35d456a1943fba6ddb84d331230..a306de412efbce0716e08b1f3e0d13519da27e2d 100644 (file)
@@ -33,6 +33,7 @@
 #include "lyxvc.h"
 #include "texrow.h"
 #include "vc-backend.h"
+#include "toc.h"
 
 #include "frontends/Alert.h"
 
@@ -193,7 +194,8 @@ Buffer * newFile(string const & filename, string const & templatename,
                        string const file = makeDisplayPath(tname, 50);
                        string const text  = bformat(_("The specified document template\n%1$s\ncould not be read."), file);
                        Alert::error(_("Could not read template"), text);
-                       // no template, start with empty buffer
+                       bufferlist.release(b);
+                       return 0;
                }
        }
 
@@ -229,15 +231,15 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr)
                                                          pos_end);
                } while (found && id_start == id_end && pos_start == pos_end);
 
-               buf.error(ErrorItem(cit->error_desc, cit->error_text,
-                                   id_start, pos_start, pos_end));
+               buf.addError(ErrorItem(cit->error_desc,
+                       cit->error_text, id_start, pos_start, pos_end));
        }
 }
 
 
 void bufferErrors(Buffer const & buf, ErrorList const & el)
 {
-       for_each(el.begin(), el.end(), bind(ref(buf.error), _1));
+       buf.setErrorList(el);
 }
 
 
@@ -513,8 +515,11 @@ bool updateCurrentLabel(Buffer const & buf,
        ParIterator & it)       
 {
     if (it == par_iterator_end(buf.inset()))
-        return true;
-       
+        return false;
+
+//     if (it.lastpit == 0 && LyXText::isMainText())
+//             return false;
+
        switch (it->layout()->labeltype) {
                
        case LABEL_NO_LABEL:
@@ -582,6 +587,8 @@ void updateLabels(Buffer const & buf)
                // set the counter for this paragraph
                setLabel(buf, it);
        }
+
+       lyx::toc::updateToc(buf);
 }