diff --git a/PowerEditor/src/Notepad_plus_Window.h b/PowerEditor/src/Notepad_plus_Window.h index c846d67d9..d02cb7bb8 100644 --- a/PowerEditor/src/Notepad_plus_Window.h +++ b/PowerEditor/src/Notepad_plus_Window.h @@ -31,12 +31,12 @@ const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\ \r\ -notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qnEasterEggName | -qtText | -qfCntentFileName] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [filePath]\r\ +notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [filePath]\r\ \r\ --help : This help message\r\ -multiInst : Launch another Notepad++ instance\r\ -noPlugin : Launch Notepad++ without loading any plugin\r\ --l : Open file or display ghost typing with syntax highlighting of choice\r\ +-l : Open file or Ghost type with syntax highlighting of choice\r\ -L : Apply indicated localization, langCode is browser language code\r\ -n : Scroll to indicated line on filePath\r\ -c : Scroll to indicated column on filePath\r\ @@ -52,9 +52,9 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNum -openSession : Open a session. filePath must be a session file\r\ -r : Open files recursively. This argument will be ignored\r\ if filePath contain no wildcard character\r\ --qn : Launch ghost typing to display easter egg via its name\r\ --qt : Launch ghost typing to display a text via the given text\r\ --qf : Launch ghost typing to display a file content via the file path\r\ +-qn=\"Easter egg name\": Ghost type easter egg via its name\r\ +-qt=\"text to display.\": Ghost type the given text\r\ +-qf=\"D:\\my quote.txt\": Ghost type a file content via the file path\r\ -qSpeed : Ghost typing speed. Value from 1 to 3 for slow, fast and fastest\r\ -quickPrint : Print the file given as argument then quit Notepad++\r\ -settingsDir=\"d:\\your settings dir\\\": Override the default settings dir\r\ diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 5cbdfde7f..dca76747b 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -262,15 +262,14 @@ int getNumberFromParam(char paramName, ParamVector & params, bool & isParamePres generic_string getEasterEggNameFromParam(ParamVector & params, unsigned char & type) { generic_string EasterEggName; - if (!getParamValFromString(TEXT("-qn"), params, EasterEggName)) // get internal easter egg + if (!getParamValFromString(TEXT("-qn="), params, EasterEggName)) // get internal easter egg { - if (!getParamValFromString(TEXT("-qt"), params, EasterEggName)) // get user quote from cmdline argument + if (!getParamValFromString(TEXT("-qt="), params, EasterEggName)) // get user quote from cmdline argument { - if (!getParamValFromString(TEXT("-qf"), params, EasterEggName)) // get user quote from a content of file + if (!getParamValFromString(TEXT("-qf="), params, EasterEggName)) // get user quote from a content of file return TEXT(""); else { - EasterEggName = relativeFilePathToFullFilePath(EasterEggName.c_str()); type = 2; // quote content in file } } @@ -280,15 +279,14 @@ generic_string getEasterEggNameFromParam(ParamVector & params, unsigned char & t else type = 0; // easter egg - generic_string percentTwentyStr = TEXT("%20"); - generic_string spaceStr = TEXT(" "); - size_t start_pos = 0; - while ((start_pos = EasterEggName.find(percentTwentyStr, start_pos)) != std::string::npos) + if (EasterEggName.c_str()[0] == '"' && EasterEggName.c_str()[EasterEggName.length() - 1] == '"') { - EasterEggName.replace(start_pos, percentTwentyStr.length(), spaceStr); - start_pos += spaceStr.length(); // Handles case where 'to' is a substring of 'from' + EasterEggName = EasterEggName.substr(1, EasterEggName.length() - 2); } + if (type == 2) + EasterEggName = relativeFilePathToFullFilePath(EasterEggName.c_str()); + return EasterEggName; }