[] Add "CURRENT_LINE" and "CURRENT_COLUMN" environment variables for run dialog.
Add NPPM_GETCURRENTLINE and NPPM_GETCURRENTCOLUMN plugin messages. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@195 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
3e705b3e64
commit
d8d5ce965f
@ -233,6 +233,14 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
||||
// The return value is TRUE when get string operation success
|
||||
// Otherwise (allocated array size is too small) FALSE
|
||||
|
||||
#define NPPM_GETCURRENTLINE (RUNCOMMAND_USER + CURRENT_LINE)
|
||||
// INT NPPM_GETCURRENTLINE(0, 0)
|
||||
// return the caret current position line
|
||||
#define NPPM_GETCURRENTCOLUMN (RUNCOMMAND_USER + CURRENT_COLUMN)
|
||||
// INT NPPM_GETCURRENTCOLUMN(0, 0)
|
||||
// return the caret current position column
|
||||
|
||||
|
||||
#define VAR_NOT_RECOGNIZED 0
|
||||
#define FULL_CURRENT_PATH 1
|
||||
#define CURRENT_DIRECTORY 2
|
||||
@ -241,6 +249,8 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
||||
#define EXT_PART 5
|
||||
#define CURRENT_WORD 6
|
||||
#define NPP_DIRECTORY 7
|
||||
#define CURRENT_LINE 8
|
||||
#define CURRENT_COLUMN 9
|
||||
|
||||
|
||||
// Notification code
|
||||
|
@ -2408,9 +2408,6 @@ void Notepad_plus::addHotSpot(bool docIsModifing)
|
||||
|
||||
vector<pair<int, int> > hotspotStylers;
|
||||
|
||||
//char *regExprStr0 = "http://[a-z0-9_-+.:?=/%]*";//"http://[^ \\t\\\"]*";
|
||||
//char *regExprStr1 = "[a-zA-Z0-9._]+@[a-zA-Z0-9_]+.[a-zA-Z0-9_]+";
|
||||
|
||||
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(urlHttpRegExpr), (LPARAM)urlHttpRegExpr);
|
||||
|
||||
while (posFound != -1)
|
||||
@ -6843,6 +6840,16 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_GETCURRENTLINE :
|
||||
{
|
||||
return _pEditView->getCurrentLineNumber();
|
||||
}
|
||||
|
||||
case NPPM_GETCURRENTCOLUMN :
|
||||
{
|
||||
return _pEditView->getCurrentColumnNumber();
|
||||
}
|
||||
|
||||
case NPPM_GETCURRENTSCINTILLA :
|
||||
{
|
||||
*((int *)lParam) = (_pEditView == &_mainEditView)?0:1;
|
||||
|
@ -79,6 +79,11 @@ int whichVar(char *str)
|
||||
return CURRENT_WORD;
|
||||
else if (!strcmp(nppDir, str))
|
||||
return NPP_DIRECTORY;
|
||||
else if (!strcmp(currentLine, str))
|
||||
return CURRENT_LINE;
|
||||
else if (!strcmp(currentColumn, str))
|
||||
return CURRENT_COLUMN;
|
||||
|
||||
return VAR_NOT_RECOGNIZED;
|
||||
}
|
||||
|
||||
@ -121,7 +126,14 @@ void expandNppEnvironmentStrs(const char *strSrc, char *stringDest, size_t strDe
|
||||
else
|
||||
{
|
||||
char expandedStr[256];
|
||||
::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, MAX_PATH, (LPARAM)expandedStr);
|
||||
if (internalVar == CURRENT_LINE || internalVar == CURRENT_COLUMN)
|
||||
{
|
||||
int lineNumber = ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, 0, 0);
|
||||
sprintf(expandedStr, "%d", lineNumber);
|
||||
}
|
||||
else
|
||||
::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, MAX_PATH, (LPARAM)expandedStr);
|
||||
|
||||
for (size_t p = 0 ; p < strlen(expandedStr) ; p++)
|
||||
stringDest[j++] = expandedStr[p];
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ const char fileNamePart[] = "NAME_PART";
|
||||
const char fileExtPart[] = "EXT_PART";
|
||||
const char currentWord[] = "CURRENT_WORD";
|
||||
const char nppDir[] = "NPP_DIRECTORY";
|
||||
const char currentLine[] = "CURRENT_LINE";
|
||||
const char currentColumn[] = "CURRENT_COLUMN";
|
||||
|
||||
int whichVar(char *str);
|
||||
void expandNppEnvironmentStrs(const char *strSrc, char *stringDest, size_t strDestLen, HWND hWnd);
|
||||
|
Loading…
Reference in New Issue
Block a user