]> git.lyx.org Git - features.git/blobdiff - src/BufferView_pimpl.C
Angus's insetref-patch and a small fix.
[features.git] / src / BufferView_pimpl.C
index 7dc44c6def37812c32981a6276817f81409d7f79..fc0f96954de1b1e42856c2f2514c269c9798c654 100644 (file)
@@ -1241,15 +1241,19 @@ void BufferView::Pimpl::restorePosition()
        
        int  x, y;
        string fname = backstack.pop(&x, &y);
-       
+
        beforeChange();
-       Buffer * b = bufferlist.exists(fname) ?
-               bufferlist.getBuffer(fname) :
-               bufferlist.loadLyXFile(fname); // don't ask, just load it
-       buffer(b);
+
+       if( fname != buffer_->fileName() ) {
+               Buffer * b = bufferlist.exists(fname) ?
+                       bufferlist.getBuffer(fname) :
+                       bufferlist.loadLyXFile(fname); // don't ask, just load it
+               if( b != 0 ) buffer(b);
+       }
+
        bv_->text->SetCursorFromCoordinates(bv_, x, y);
        update(BufferView::SELECT|BufferView::FITCUR);
-} 
+}
 
 
 bool BufferView::Pimpl::NoSavedPositions()