Enhance ghost typing command line argument feature
Enhance ghost typing command line argument feature by changing its format: With it's new format -qX="string contains white space" (where X is 't', 'n' or 'f'), the white spaces can be contained between double quote, so no need to use %20 anymore for substituting white spacees.
This commit is contained in:
parent
b6a66ba2b1
commit
f617325006
@ -31,12 +31,12 @@
|
|||||||
|
|
||||||
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
||||||
\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\
|
\r\
|
||||||
--help : This help message\r\
|
--help : This help message\r\
|
||||||
-multiInst : Launch another Notepad++ instance\r\
|
-multiInst : Launch another Notepad++ instance\r\
|
||||||
-noPlugin : Launch Notepad++ without loading any plugin\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\
|
-L : Apply indicated localization, langCode is browser language code\r\
|
||||||
-n : Scroll to indicated line on filePath\r\
|
-n : Scroll to indicated line on filePath\r\
|
||||||
-c : Scroll to indicated column 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\
|
-openSession : Open a session. filePath must be a session file\r\
|
||||||
-r : Open files recursively. This argument will be ignored\r\
|
-r : Open files recursively. This argument will be ignored\r\
|
||||||
if filePath contain no wildcard character\r\
|
if filePath contain no wildcard character\r\
|
||||||
-qn : Launch ghost typing to display easter egg via its name\r\
|
-qn=\"Easter egg name\": Ghost type easter egg via its name\r\
|
||||||
-qt : Launch ghost typing to display a text via the given text\r\
|
-qt=\"text to display.\": Ghost type the given text\r\
|
||||||
-qf : Launch ghost typing to display a file content via the file path\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\
|
-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\
|
-quickPrint : Print the file given as argument then quit Notepad++\r\
|
||||||
-settingsDir=\"d:\\your settings dir\\\": Override the default settings dir\r\
|
-settingsDir=\"d:\\your settings dir\\\": Override the default settings dir\r\
|
||||||
|
@ -262,15 +262,14 @@ int getNumberFromParam(char paramName, ParamVector & params, bool & isParamePres
|
|||||||
generic_string getEasterEggNameFromParam(ParamVector & params, unsigned char & type)
|
generic_string getEasterEggNameFromParam(ParamVector & params, unsigned char & type)
|
||||||
{
|
{
|
||||||
generic_string EasterEggName;
|
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("");
|
return TEXT("");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EasterEggName = relativeFilePathToFullFilePath(EasterEggName.c_str());
|
|
||||||
type = 2; // quote content in file
|
type = 2; // quote content in file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,15 +279,14 @@ generic_string getEasterEggNameFromParam(ParamVector & params, unsigned char & t
|
|||||||
else
|
else
|
||||||
type = 0; // easter egg
|
type = 0; // easter egg
|
||||||
|
|
||||||
generic_string percentTwentyStr = TEXT("%20");
|
if (EasterEggName.c_str()[0] == '"' && EasterEggName.c_str()[EasterEggName.length() - 1] == '"')
|
||||||
generic_string spaceStr = TEXT(" ");
|
|
||||||
size_t start_pos = 0;
|
|
||||||
while ((start_pos = EasterEggName.find(percentTwentyStr, start_pos)) != std::string::npos)
|
|
||||||
{
|
{
|
||||||
EasterEggName.replace(start_pos, percentTwentyStr.length(), spaceStr);
|
EasterEggName = EasterEggName.substr(1, EasterEggName.length() - 2);
|
||||||
start_pos += spaceStr.length(); // Handles case where 'to' is a substring of 'from'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == 2)
|
||||||
|
EasterEggName = relativeFilePathToFullFilePath(EasterEggName.c_str());
|
||||||
|
|
||||||
return EasterEggName;
|
return EasterEggName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user