commit 1dd4870f0b97f67ec63d9412601b69a84d37bb8e
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Jul 6 21:26:23 2025 +0200
Restore last opened file when opening LyX with file argument (#10362)
---
src/LyX.cpp | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/LyX.cpp b/src/LyX.cpp
index 8c467f5e6a..f96354c78d 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -612,17 +612,13 @@ void LyX::execCommands()
// create the first main window
lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW));
- if (!pimpl_->files_to_load_.empty()) {
- // if some files were specified at command-line we assume that
the
- // user wants to edit *these* files and not to restore the
session.
- for (size_t i = 0; i != pimpl_->files_to_load_.size(); ++i) {
- lyx::dispatch(
- FuncRequest(LFUN_FILE_OPEN,
pimpl_->files_to_load_[i]));
- }
- // clear this list to save a few bytes of RAM
- pimpl_->files_to_load_.clear();
- } else
- pimpl_->application_->restoreGuiSession();
+ // restore GUI session first
+ pimpl_->application_->restoreGuiSession();
+ // the user wants to edit these files specified at command-line
+ for (string const & file : pimpl_->files_to_load_)
+ lyx::dispatch(FuncRequest(LFUN_FILE_OPEN, file));
+ // clear this list to save a few bytes of RAM
+ pimpl_->files_to_load_.clear();
// Execute batch commands if available
if (pimpl_->batch_commands.empty())
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs