Fix bug #5878: Cursor position not restored in hidden documents.

A hidden document does not have an associated Cursor. So, each time we create a new workArea, we should restore the cursor position.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35811 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-24 23:41:15 +00:00
parent 5071c5b008
commit 9fbc3dd5ba

View File

@ -1328,6 +1328,12 @@ void GuiView::setBuffer(Buffer * newBuffer)
if (wa == 0) {
newBuffer->masterBuffer()->updateBuffer();
wa = addWorkArea(*newBuffer);
// scroll to the position when the file was last closed
if (lyxrc.use_lastfilepos) {
LastFilePosSection::FilePos filepos =
theSession().lastFilePos().load(newBuffer->fileName());
wa->bufferView().moveToPosition(filepos.pit, filepos.pos, 0, 0);
}
} else {
//Disconnect the old buffer...there's no new one.
disconnectBuffer();
@ -1811,13 +1817,6 @@ Buffer * GuiView::loadDocument(FileName const & filename, bool tolastfiles)
setBuffer(newBuffer);
// scroll to the position when the file was last closed
if (lyxrc.use_lastfilepos) {
LastFilePosSection::FilePos filepos =
theSession().lastFilePos().load(filename);
documentBufferView()->moveToPosition(filepos.pit, filepos.pos, 0, 0);
}
if (tolastfiles)
theSession().lastFiles().add(filename);