From 8202f631603cb748bbf9cf0a7731c26c21bc937b Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 22 Aug 2007 09:06:13 +0000 Subject: [PATCH] transfer cursor position saving (in the session) from ~WorkArea to ~BufferView. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19719 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 8 ++++++++ src/frontends/WorkArea.cpp | 11 ----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index b7776050cd..5d41d1b162 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -142,6 +142,14 @@ BufferView::BufferView(Buffer & buf) BufferView::~BufferView() { + // 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( + support::FileName(buffer_.fileName()), + boost::tie(cursor_.bottom().pit(), cursor_.bottom().pos()) ); } diff --git a/src/frontends/WorkArea.cpp b/src/frontends/WorkArea.cpp index 037831ab08..d27816a676 100644 --- a/src/frontends/WorkArea.cpp +++ b/src/frontends/WorkArea.cpp @@ -29,7 +29,6 @@ #include "Font.h" #include "FuncRequest.h" #include "Language.h" -#include "LyX.h" #include "LyXFunc.h" #include "LyXRC.h" #include "MetricsInfo.h" @@ -90,16 +89,6 @@ WorkArea::~WorkArea() bufferChangedConnection_.disconnect(); bufferClosingConnection_.disconnect(); - // 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. - Cursor & cur = buffer_view_->cursor(); - LyX::ref().session().lastFilePos().save( - support::FileName(buffer_view_->buffer().fileName()), - boost::tie(cur.bottom().pit(), cur.bottom().pos()) ); - delete buffer_view_; }