From 9fbc3dd5ba17c5c5fb15e3a47ad89417672152f5 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 24 Oct 2010 23:41:15 +0000 Subject: [PATCH] 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 --- src/frontends/qt4/GuiView.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 585c24c49b..5d604fca05 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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); -- 2.39.2