diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 4156ddeac..05448b864 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -759,11 +759,6 @@ void Notepad_plus::saveShortcuts() NppParameters::getInstance()->writeShortcuts(); } -void Notepad_plus::saveSession(const Session & session) -{ - (NppParameters::getInstance())->writeSession(session); -} - void Notepad_plus::doTrimTrailing() { _pEditView->execute(SCI_BEGINUNDOACTION); diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 1181f1c82..c60bea10b 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1071,3 +1071,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames) } +void Notepad_plus::saveSession(const Session & session) +{ + (NppParameters::getInstance())->writeSession(session); +} diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 4a443fd77..62c002370 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -39,20 +39,27 @@ void parseCommandLine(TCHAR * commandLine, ParamVector & paramVector) { //params.erase(params.begin()); //remove the first element, since thats the path the the executable (GetCommandLine does that) TCHAR stopChar = TEXT(' '); - if (commandLine[0] == TEXT('\"')) { stopChar = TEXT('\"'); commandLine++; } //while this is not really DBCS compliant, space and quote are in the lower 127 ASCII range while(commandLine[0] && commandLine[0] != stopChar) + { commandLine++; - commandLine++; //advance past stopChar + } + + // For unknown reason, the following command : + // c:\NppDir>notepad++ + // (without quote) will give string "notepad++\0notepad++\0" + // To avoid the unexpected behaviour we check the end of string before increasing the pointer + if (commandLine[0] != '\0') + commandLine++; //advance past stopChar + //kill remaining spaces while(commandLine[0] == TEXT(' ')) commandLine++; - bool isFile = checkSingleFile(commandLine); //if the commandline specifies only a file, open it as such if (isFile) { paramVector.push_back(commandLine);