Dear list, Currently, if a help document is reload by the session system, it will be added to lastfile list. This patch corrects this.
OK to apply? Bo
Index: src/frontends/gtk/lyx_gui.C =================================================================== --- src/frontends/gtk/lyx_gui.C (revision 14498) +++ src/frontends/gtk/lyx_gui.C (working copy) @@ -33,6 +33,7 @@ #include "lyxrc.h" #include "lyxfont.h" #include "graphics/LoaderQueue.h" +#include "session.h" #include "io_callback.h" @@ -162,6 +163,18 @@ for_each(files.begin(), files.end(), bind(&LyXView::loadLyXFile, &view, _1, true)); + // if a file is specified, I assume that user wants to edit *that* file + if (files.empty() && lyxrc.load_session) { + vector<string> const & lastopened = LyX::ref().session().lastOpenedFiles(); + // do not add to the lastfile list since these files are restored from + // last seesion, and should be already there (regular files), or should + // not be added at all (help files). + for_each(lastopened.begin(), lastopened.end(), + bind(&LyXView::loadLyXFile, &view, _1, false)); + } + // clear this list to save a few bytes of RAM + LyX::ref().session().clearLastOpenedFiles(); + // handle the batch commands the user asked for if (!batch.empty()) { view.getLyXFunc().dispatch(lyxaction.lookupFunc(batch)); Index: src/frontends/qt3/lyx_gui.C =================================================================== --- src/frontends/qt3/lyx_gui.C (revision 14498) +++ src/frontends/qt3/lyx_gui.C (working copy) @@ -25,6 +25,7 @@ #include "lyxrc.h" #include "lyxserver.h" #include "lyxsocket.h" +#include "session.h" #include "graphics/LoaderQueue.h" @@ -267,6 +268,18 @@ for_each(files.begin(), files.end(), bind(&LyXView::loadLyXFile, &view, _1, true)); + // if a file is specified, I assume that user wants to edit *that* file + if (files.empty() && lyxrc.load_session) { + vector<string> const & lastopened = LyX::ref().session().lastOpenedFiles(); + // do not add to the lastfile list since these files are restored from + // last seesion, and should be already there (regular files), or should + // not be added at all (help files). + for_each(lastopened.begin(), lastopened.end(), + bind(&LyXView::loadLyXFile, &view, _1, false)); + } + // clear this list to save a few bytes of RAM + LyX::ref().session().clearLastOpenedFiles(); + // handle the batch commands the user asked for if (!batch.empty()) { view.getLyXFunc().dispatch(lyxaction.lookupFunc(batch)); Index: src/frontends/qt4/lyx_gui.C =================================================================== --- src/frontends/qt4/lyx_gui.C (revision 14498) +++ src/frontends/qt4/lyx_gui.C (working copy) @@ -28,6 +28,7 @@ #include "lyxrc.h" #include "lyxserver.h" #include "lyxsocket.h" +#include "session.h" #include "graphics/LoaderQueue.h" @@ -242,6 +243,18 @@ for_each(files.begin(), files.end(), bind(&LyXView::loadLyXFile, &view, _1, true)); + // if a file is specified, I assume that user wants to edit *that* file + if (files.empty() && lyxrc.load_session) { + vector<string> const & lastopened = LyX::ref().session().lastOpenedFiles(); + // do not add to the lastfile list since these files are restored from + // last seesion, and should be already there (regular files), or should + // not be added at all (help files). + for_each(lastopened.begin(), lastopened.end(), + bind(&LyXView::loadLyXFile, &view, _1, false)); + } + // clear this list to save a few bytes of RAM + LyX::ref().session().clearLastOpenedFiles(); + // handle the batch commands the user asked for if (!batch.empty()) { view.getLyXFunc().dispatch(lyxaction.lookupFunc(batch)); Index: src/lyx_main.C =================================================================== --- src/lyx_main.C (revision 14498) +++ src/lyx_main.C (working copy) @@ -259,14 +259,6 @@ if (first_start) files.push_back(i18nLibFileSearch("examples", "splash.lyx")); - // if a file is specified, I assume that user wants to edit *that* file - if (files.empty() && lyxrc.load_session) { - vector<string> const & lastopened = session_->lastOpenedFiles(); - files.insert(files.end(), lastopened.begin(), lastopened.end() ); - } - // clear this list to save a few bytes of RAM - session_->clearLastOpenedFiles(); - // Execute batch commands if available if (!batch_command.empty()) {