const_cast<BookmarksSection::Bookmark &>(bm).setPos(new_pit, new_id);
}
// current buffer is going to be switched-off, save cursor pos
+ // Ideally, the whole cursor stack should be saved, but session
+ // currently can only handle bottom (whole document) level pit and pos.
+ // That is to say, if a cursor is in a nested inset, it will be
+ // restore to the left of the top level inset.
LyX::ref().session().lastFilePos().save(FileName(buffer_->fileName()),
- boost::tie(cursor_.pit(), cursor_.pos()) );
+ boost::tie(cursor_.bottom().pit(), cursor_.bottom().pos()) );
}
// If we're quitting lyx, don't bother updating stuff
if (view()->buffer()) {
// save cursor position for opened files to .lyx/session
+ // only bottom (whole doc) level pit and pos is saved.
LyX::ref().session().lastFilePos().save(
FileName(buffer()->fileName()),
- boost::tie(view()->cursor().pit(),
- view()->cursor().pos()));
+ boost::tie(view()->cursor().bottom().pit(),
+ view()->cursor().bottom().pos()));
}
// this is the place where we leave the frontend.
void LyXFunc::closeBuffer()
{
- // save current cursor position
- LyX::ref().session().lastFilePos().save(FileName(lyx_view_->buffer()->fileName()),
- boost::tie(view()->cursor().pit(), view()->cursor().pos()) );
// goto bookmark to update bookmark pit.
for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i)
gotoBookmark(i+1, false, false);