Add API NPPM_GETCURRENTLINESTR & RunDlg's variable $(CURRENT_LINESTR)
Add new API NPPM_GETCURRENTLINESTR and new variable $(CURRENT_LINESTR) for RunDlg to get the whole current line string. Fix #11216, close #11265
This commit is contained in:
parent
ca8c302805
commit
052b27e3d7
|
@ -466,6 +466,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
|
||||||
#define CURRENT_COLUMN 9
|
#define CURRENT_COLUMN 9
|
||||||
#define NPP_FULL_FILE_PATH 10
|
#define NPP_FULL_FILE_PATH 10
|
||||||
#define GETFILENAMEATCURSOR 11
|
#define GETFILENAMEATCURSOR 11
|
||||||
|
#define CURRENT_LINESTR 12
|
||||||
|
|
||||||
#define RUNCOMMAND_USER (WM_USER + 3000)
|
#define RUNCOMMAND_USER (WM_USER + 3000)
|
||||||
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
|
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
|
||||||
|
@ -476,6 +477,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
|
||||||
#define NPPM_GETCURRENTWORD (RUNCOMMAND_USER + CURRENT_WORD)
|
#define NPPM_GETCURRENTWORD (RUNCOMMAND_USER + CURRENT_WORD)
|
||||||
#define NPPM_GETNPPDIRECTORY (RUNCOMMAND_USER + NPP_DIRECTORY)
|
#define NPPM_GETNPPDIRECTORY (RUNCOMMAND_USER + NPP_DIRECTORY)
|
||||||
#define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR)
|
#define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR)
|
||||||
|
#define NPPM_GETCURRENTLINESTR (RUNCOMMAND_USER + CURRENT_LINESTR)
|
||||||
// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str)
|
// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str)
|
||||||
// where str is the allocated TCHAR array,
|
// where str is the allocated TCHAR array,
|
||||||
// strLen is the allocated array size
|
// strLen is the allocated array size
|
||||||
|
|
|
@ -859,11 +859,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_GETCURRENTWORD:
|
case NPPM_GETCURRENTWORD:
|
||||||
|
case NPPM_GETCURRENTLINESTR:
|
||||||
{
|
{
|
||||||
const int strSize = CURRENTWORD_MAXLENGTH;
|
const int strSize = CURRENTWORD_MAXLENGTH;
|
||||||
TCHAR str[strSize];
|
TCHAR str[strSize] = { '\0' };
|
||||||
TCHAR *pTchar = reinterpret_cast<TCHAR *>(lParam);
|
TCHAR *pTchar = reinterpret_cast<TCHAR *>(lParam);
|
||||||
|
|
||||||
|
if (message == NPPM_GETCURRENTWORD)
|
||||||
_pEditView->getGenericSelectedText(str, strSize);
|
_pEditView->getGenericSelectedText(str, strSize);
|
||||||
|
else if (message == NPPM_GETCURRENTLINESTR)
|
||||||
|
_pEditView->getLine(_pEditView->getCurrentLineNumber(), str, strSize);
|
||||||
|
|
||||||
// For the compability reason, if wParam is 0, then we assume the size of generic_string buffer (lParam) is large enough.
|
// For the compability reason, if wParam is 0, then we assume the size of generic_string buffer (lParam) is large enough.
|
||||||
// otherwise we check if the generic_string buffer size is enough for the generic_string to copy.
|
// otherwise we check if the generic_string buffer size is enough for the generic_string to copy.
|
||||||
if (wParam != 0)
|
if (wParam != 0)
|
||||||
|
|
|
@ -95,6 +95,8 @@ int whichVar(TCHAR *str)
|
||||||
return CURRENT_LINE;
|
return CURRENT_LINE;
|
||||||
else if (!lstrcmp(currentColumn, str))
|
else if (!lstrcmp(currentColumn, str))
|
||||||
return CURRENT_COLUMN;
|
return CURRENT_COLUMN;
|
||||||
|
else if (!lstrcmp(currentLineStr, str))
|
||||||
|
return CURRENT_LINESTR;
|
||||||
|
|
||||||
return VAR_NOT_RECOGNIZED;
|
return VAR_NOT_RECOGNIZED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ const TCHAR nppDir[] = TEXT("NPP_DIRECTORY");
|
||||||
const TCHAR nppFullFilePath[] = TEXT("NPP_FULL_FILE_PATH");
|
const TCHAR nppFullFilePath[] = TEXT("NPP_FULL_FILE_PATH");
|
||||||
const TCHAR currentLine[] = TEXT("CURRENT_LINE");
|
const TCHAR currentLine[] = TEXT("CURRENT_LINE");
|
||||||
const TCHAR currentColumn[] = TEXT("CURRENT_COLUMN");
|
const TCHAR currentColumn[] = TEXT("CURRENT_COLUMN");
|
||||||
|
const TCHAR currentLineStr[] = TEXT("CURRENT_LINESTR");
|
||||||
|
|
||||||
int whichVar(TCHAR *str);
|
int whichVar(TCHAR *str);
|
||||||
void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd);
|
void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd);
|
||||||
|
|
Loading…
Reference in New Issue