]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.C
reduce number of calls to LyXText::getFont
[lyx.git] / src / buffer_funcs.C
index c14303095251839a651b04cbb9371966b76900cc..2aee55c78e46fdcff8ebad41570bd9eaecec3f8f 100644 (file)
@@ -212,15 +212,19 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr)
        TeXErrors::Errors::const_iterator end = terr.end();
 
        for (; cit != end; ++cit) {
-               int par_id = -1;
-               int posstart = -1;
-               int const errorrow = cit->error_in_line;
-               buf.texrow().getIdFromRow(errorrow, par_id, posstart);
-               int posend = -1;
-               buf.texrow().getIdFromRow(errorrow + 1, par_id, posend);
-               buf.error(ErrorItem(cit->error_desc,
-                                        cit->error_text,
-                                        par_id, posstart, posend));
+               int id_start = -1;
+               int pos_start = -1;
+               int errorrow = cit->error_in_line;
+               buf.texrow().getIdFromRow(errorrow, id_start, pos_start);
+               int id_end = -1;
+               int pos_end = -1;
+               do {
+                       ++errorrow;
+                       buf.texrow().getIdFromRow(errorrow, id_end, pos_end);
+               } while (id_start == id_end && pos_start == pos_end);
+
+               buf.error(ErrorItem(cit->error_desc, cit->error_text,
+                                   id_start, pos_start, pos_end));
        }
 }
 
@@ -440,7 +444,7 @@ void setCounter(Buffer const & buf, ParIterator & it)
        } else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
                counters.step("bibitem");
                int number = counters.value("bibitem");
-               if (par.bibitem()) 
+               if (par.bibitem())
                        par.bibitem()->setCounter(number);
                par.params().labelString(buf.B_(layout->labelstring()));
                // In biblio should't be following counters but...
@@ -503,7 +507,7 @@ string expandLabel(Buffer const & buf,
 {
        LyXTextClass const & tclass = buf.params().getLyXTextClass();
 
-       string fmt = buf.B_(appendix ? layout->labelstring_appendix() 
+       string fmt = buf.B_(appendix ? layout->labelstring_appendix()
                            : layout->labelstring());
 
        // handle 'inherited level parts' in 'fmt',