diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 3db3f2d16..179294dd6 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1051,7 +1051,7 @@ You can define several column markers by using white space to separate the diffe - + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index 04aba5534..3f920b9aa 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -1028,7 +1028,7 @@ Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour - + diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml index ca0cb2947..9d9896a7d 100644 --- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml +++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml @@ -1043,7 +1043,7 @@ - + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index fbe233a8a..109d0b5c0 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -6096,6 +6096,8 @@ std::vector Notepad_plus::loadCommandlineParams(const TCHAR * co { const bool isSnapshotMode = false; const bool shouldLoadFileBrowser = true; + + nppParams.setLoadedSessionFilePath(fnss.getFileName(0)); loadSession(session2Load, isSnapshotMode, shouldLoadFileBrowser); } return std::vector(); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 0c710dd07..0db8cffd7 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1995,6 +1995,14 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa if (nppgui._rememberLastSession && !nppgui._isCmdlineNosessionActivated) saveSession(currentSession); + // + // saving session.xml into loaded session if a saved session is loaded and saveLoadedSessionOnExit option is enabled + // + + generic_string loadedSessionFilePath = nppParam.getLoadedSessionFilePath(); + if (!loadedSessionFilePath.empty() && PathFileExists(loadedSessionFilePath.c_str())) + nppParam.writeSession(currentSession, loadedSessionFilePath.c_str()); + // write settings on cloud if enabled, if the settings files don't exist if (nppgui._cloudPath != TEXT("") && nppParam.isCloudPathChanged()) { diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 28b36bded..3ffe0eb83 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -2296,15 +2296,17 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn) bool isAllSuccessful = true; Session session2Load; - if ((NppParameters::getInstance()).loadSession(session2Load, sessionFileName.c_str())) + if (nppParam.loadSession(session2Load, sessionFileName.c_str())) { const bool isSnapshotMode = false; const bool shouldLoadFileBrowser = true; isAllSuccessful = loadSession(session2Load, isSnapshotMode, shouldLoadFileBrowser); result = true; + if (isEmptyNpp && (nppGUI._multiInstSetting == multiInstOnSession || nppGUI._multiInstSetting == multiInst)) + nppParam.setLoadedSessionFilePath(sessionFileName); } if (!isAllSuccessful) - (NppParameters::getInstance()).writeSession(session2Load, sessionFileName.c_str()); + nppParam.writeSession(session2Load, sessionFileName.c_str()); } if (result == false) { @@ -2315,6 +2317,7 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn) MB_OK); } } + return result; } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 703660fda..58fb61b94 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2093,7 +2093,6 @@ void NppParameters::setWorkingDir(const TCHAR * newPath) } } - bool NppParameters::loadSession(Session & session, const TCHAR *sessionFileName) { TiXmlDocument *pXmlSessionDocument = new TiXmlDocument(sessionFileName); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index e18186370..1ec45aada 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1540,6 +1540,15 @@ public: }; bool loadSession(Session & session, const TCHAR *sessionFileName); + + void setLoadedSessionFilePath(const generic_string & loadedSessionFilePath) { + _loadedSessionFullFilePath = loadedSessionFilePath; + }; + + generic_string getLoadedSessionFilePath() { + return _loadedSessionFullFilePath; + }; + int langTypeToCommandID(LangType lt) const; WNDPROC getEnableThemeDlgTexture() const {return _enableThemeDialogTextureFuncAddr;}; @@ -1731,6 +1740,8 @@ private: generic_string _cmdSettingsDir; generic_string _titleBarAdditional; + generic_string _loadedSessionFullFilePath; + public: void setShortcutDirty() { _isAnyShortcutModified = true; }; void setAdminMode(bool isAdmin) { _isAdminMode = isAdmin; } diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index eb7c3e992..66fefc32d 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -383,7 +383,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Multi-instance settings",IDC_MULTIINST_GB_STATIC,89,3,268,89,BS_CENTER - CONTROL "Open session in a new instance of Notepad++",IDC_SESSIONININST_RADIO,"Button",BS_AUTORADIOBUTTON,122,17,226,10 + CONTROL "Open session in a new instance (and save session automatically on exit)",IDC_SESSIONININST_RADIO,"Button",BS_AUTORADIOBUTTON|BS_MULTILINE,122,10,226,20 CONTROL "Always in multi-instance mode",IDC_MULTIINST_RADIO,"Button",BS_AUTORADIOBUTTON,122,34,218,10 CONTROL "Default (mono-instance)",IDC_MONOINST_RADIO,"Button",BS_AUTORADIOBUTTON,122,51,196,10 LTEXT "* The modification of this setting needs to restart Notepad++",IDD_STATIC_RESTARTNOTE,110,70,239,20