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
This commit is contained in:
xomx 2022-02-21 14:31:25 +01:00 committed by Don Ho
parent 3de15f5512
commit e839b81e85
1 changed files with 3 additions and 1 deletions

View File

@ -6097,6 +6097,7 @@ std::vector<generic_string> Notepad_plus::loadCommandlineParams(const TCHAR * co
return std::vector<generic_string>();
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<generic_string> 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<generic_string>();