diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index a31f69a46..0ea9756fc 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -466,6 +466,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define CURRENT_COLUMN 9 #define NPP_FULL_FILE_PATH 10 #define GETFILENAMEATCURSOR 11 +#define CURRENT_LINESTR 12 #define RUNCOMMAND_USER (WM_USER + 3000) #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_GETNPPDIRECTORY (RUNCOMMAND_USER + NPP_DIRECTORY) #define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR) + #define NPPM_GETCURRENTLINESTR (RUNCOMMAND_USER + CURRENT_LINESTR) // BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str) // where str is the allocated TCHAR array, // strLen is the allocated array size diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index a7388bd43..f2d145718 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -859,11 +859,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa } case NPPM_GETCURRENTWORD: + case NPPM_GETCURRENTLINESTR: { const int strSize = CURRENTWORD_MAXLENGTH; - TCHAR str[strSize]; + TCHAR str[strSize] = { '\0' }; TCHAR *pTchar = reinterpret_cast(lParam); - _pEditView->getGenericSelectedText(str, strSize); + + if (message == NPPM_GETCURRENTWORD) + _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. // otherwise we check if the generic_string buffer size is enough for the generic_string to copy. if (wParam != 0) diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp index 992ab72aa..b21b84e70 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp @@ -95,6 +95,8 @@ int whichVar(TCHAR *str) return CURRENT_LINE; else if (!lstrcmp(currentColumn, str)) return CURRENT_COLUMN; + else if (!lstrcmp(currentLineStr, str)) + return CURRENT_LINESTR; return VAR_NOT_RECOGNIZED; } diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h index 949fb4464..af8ad81f9 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.h @@ -32,6 +32,7 @@ const TCHAR nppDir[] = TEXT("NPP_DIRECTORY"); const TCHAR nppFullFilePath[] = TEXT("NPP_FULL_FILE_PATH"); const TCHAR currentLine[] = TEXT("CURRENT_LINE"); const TCHAR currentColumn[] = TEXT("CURRENT_COLUMN"); +const TCHAR currentLineStr[] = TEXT("CURRENT_LINESTR"); int whichVar(TCHAR *str); void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd);