]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView2.C
citation patch from Angus
[lyx.git] / src / BufferView2.C
index 723381e34cebd02e064a663d3d02b57bddee8ac9..e58b0e4ef7665cdebe8851e7895d1aa701576b1e 100644 (file)
@@ -73,10 +73,11 @@ bool BufferView::insertLyXFile(string const & filen)
                           MakeDisplayPath(fname, 50));
                return false;
        }
+       
+       char c = ifs.peek();
+       
        LyXLex lex(0, 0);
        lex.setStream(ifs);
-       char c; ifs.get(c);
-       ifs.putback(c);
 
        bool res = true;
 
@@ -152,8 +153,10 @@ void BufferView::insertErrors(TeXErrors & terr)
                int tmpid = -1; 
                int tmppos = -1;
 
-               buffer()->texrow.getIdFromRow(errorrow, tmpid, tmppos);
-
+               if (buffer()->texrow.getIdFromRow(errorrow, tmpid, tmppos)) {
+                       buffer()->texrow.increasePos(tmpid, tmppos);
+               }
+               
                LyXParagraph * texrowpar = 0;
 
                if (tmpid == -1) {
@@ -809,10 +812,16 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
        if (kind == Undo::EDIT) // in this case insets would not be stored!
                kind = Undo::FINISH;
        text->SetUndo(buffer(), kind,
+#ifndef NEW_INSETS
                      text->cursor.par()->
                      ParFromPos(text->cursor.pos())->previous, 
                      text->cursor.par()->
-                     ParFromPos(text->cursor.pos())->next);
+                     ParFromPos(text->cursor.pos())->next
+#else
+                     text->cursor.par()->previous, 
+                     text->cursor.par()->next
+#endif
+               );
 }
 
 
@@ -870,8 +879,13 @@ bool BufferView::ChangeRefs(string const & from, string const & to)
        LyXParagraph * par = buffer()->paragraph;
        LyXCursor cursor = text->cursor;
        LyXCursor tmpcursor = cursor;
+#ifndef NEW_INSETS
        cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
        cursor.pos(tmpcursor.par()->PositionInParFromPos(tmpcursor.pos()));
+#else
+       cursor.par(tmpcursor.par());
+       cursor.pos(tmpcursor.pos());
+#endif
 
        while (par) {
                bool flag2 = false;