lastFilePos: save bottom level pit and pos

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17814 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-04-15 04:50:42 +00:00
parent 15aade70e7
commit 9cf5358d7d
3 changed files with 8 additions and 6 deletions

View File

@ -168,8 +168,12 @@ void BufferView::setBuffer(Buffer * b)
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

View File

@ -260,10 +260,11 @@ void GuiView::closeEvent(QCloseEvent * close_event)
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.

View File

@ -2040,9 +2040,6 @@ void LyXFunc::doImport(string const & argument)
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);