From e839b81e85f10b7a493ed556e218fe48aa1131fc Mon Sep 17 00:00:00 2001 From: xomx Date: Mon, 21 Feb 2022 14:31:25 +0100 Subject: [PATCH] Refine autosaving session on exit behaviour Refine autosaving session on exit behaviour on only "Open session in a new instance" or "always in multi-Instance". If the "Default (mono-instance)" is chosen and the session is launched via command line with flag "-multiInst", the modified session won't be saved automatically. Fixes #11249, close #11255 --- PowerEditor/src/Notepad_plus.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3fba70fd1..cfaec8d0c 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -6097,6 +6097,7 @@ std::vector Notepad_plus::loadCommandlineParams(const TCHAR * co return std::vector(); NppParameters& nppParams = NppParameters::getInstance(); + const NppGUI& nppGUI = nppParams.getNppGUI(); FileNameStringSplitter fnss(commandLine); // loading file as session file is allowed only when there is only one file @@ -6108,7 +6109,8 @@ std::vector Notepad_plus::loadCommandlineParams(const TCHAR * co const bool isSnapshotMode = false; const bool shouldLoadFileBrowser = true; - nppParams.setLoadedSessionFilePath(fnss.getFileName(0)); + if ((nppGUI._multiInstSetting == multiInstOnSession) || (nppGUI._multiInstSetting == multiInst)) + nppParams.setLoadedSessionFilePath(fnss.getFileName(0)); loadSession(session2Load, isSnapshotMode, shouldLoadFileBrowser); } return std::vector();