Fix local variable shadows outer variable issues
parent
6ddbca3a60
commit
2d15d90e02
|
@ -2677,10 +2677,10 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
|
||||||
{
|
{
|
||||||
indentAmountPrevLine = _pEditView->getLineIndent(prevLine);
|
indentAmountPrevLine = _pEditView->getLineIndent(prevLine);
|
||||||
|
|
||||||
auto startPos = _pEditView->execute(SCI_POSITIONFROMLINE, prevLine);
|
auto startPos2 = _pEditView->execute(SCI_POSITIONFROMLINE, prevLine);
|
||||||
auto endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, prevLine);
|
auto endPos2 = _pEditView->execute(SCI_GETLINEENDPOSITION, prevLine);
|
||||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
||||||
_pEditView->execute(SCI_SETTARGETRANGE, startPos, endPos);
|
_pEditView->execute(SCI_SETTARGETRANGE, startPos2, endPos2);
|
||||||
|
|
||||||
const char braceExpr[] = "[ \t]*\\{.*";
|
const char braceExpr[] = "[ \t]*\\{.*";
|
||||||
|
|
||||||
|
@ -2688,7 +2688,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
|
||||||
if (posFound != -1 && posFound != -2)
|
if (posFound != -1 && posFound != -2)
|
||||||
{
|
{
|
||||||
int end = int(_pEditView->execute(SCI_GETTARGETEND));
|
int end = int(_pEditView->execute(SCI_GETTARGETEND));
|
||||||
if (end == endPos)
|
if (end == endPos2)
|
||||||
indentAmountPrevLine += tabWidth;
|
indentAmountPrevLine += tabWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3253,7 +3253,6 @@ void Notepad_plus::dropFiles(HDROP hdrop)
|
||||||
switchEditViewTo(MAIN_VIEW);
|
switchEditViewTo(MAIN_VIEW);
|
||||||
|
|
||||||
int filesDropped = ::DragQueryFile(hdrop, 0xffffffff, NULL, 0);
|
int filesDropped = ::DragQueryFile(hdrop, 0xffffffff, NULL, 0);
|
||||||
BufferID lastOpened = BUFFER_INVALID;
|
|
||||||
|
|
||||||
vector<generic_string> folderPaths;
|
vector<generic_string> folderPaths;
|
||||||
vector<generic_string> filePaths;
|
vector<generic_string> filePaths;
|
||||||
|
@ -3282,7 +3281,6 @@ void Notepad_plus::dropFiles(HDROP hdrop)
|
||||||
|
|
||||||
if (isOldMode || folderPaths.size() == 0) // old mode or new mode + only files
|
if (isOldMode || folderPaths.size() == 0) // old mode or new mode + only files
|
||||||
{
|
{
|
||||||
|
|
||||||
BufferID lastOpened = BUFFER_INVALID;
|
BufferID lastOpened = BUFFER_INVALID;
|
||||||
for (int i = 0; i < filesDropped; ++i)
|
for (int i = 0; i < filesDropped; ++i)
|
||||||
{
|
{
|
||||||
|
@ -3313,10 +3311,6 @@ void Notepad_plus::dropFiles(HDROP hdrop)
|
||||||
launchFileBrowser(folderPaths);
|
launchFileBrowser(folderPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastOpened != BUFFER_INVALID)
|
|
||||||
{
|
|
||||||
switchToFile(lastOpened);
|
|
||||||
}
|
|
||||||
::DragFinish(hdrop);
|
::DragFinish(hdrop);
|
||||||
// Put Notepad_plus to forefront
|
// Put Notepad_plus to forefront
|
||||||
// May not work for Win2k, but OK for lower versions
|
// May not work for Win2k, but OK for lower versions
|
||||||
|
|
|
@ -234,8 +234,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
bool res = MainFileManager->createEmptyFile(longFileName);
|
bool isOK = MainFileManager->createEmptyFile(longFileName);
|
||||||
if (res)
|
if (isOK)
|
||||||
{
|
{
|
||||||
isCreateFileSuccessful = true;
|
isCreateFileSuccessful = true;
|
||||||
}
|
}
|
||||||
|
@ -293,15 +293,15 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
||||||
|
|
||||||
if (buffer != BUFFER_INVALID)
|
if (buffer != BUFFER_INVALID)
|
||||||
{
|
{
|
||||||
bool isSnapshotMode = (backupFileName != NULL and PathFileExists(backupFileName));
|
isSnapshotMode = (backupFileName != NULL && ::PathFileExists(backupFileName));
|
||||||
if (isSnapshotMode)
|
if (isSnapshotMode)
|
||||||
{
|
{
|
||||||
// To notify plugins that a snapshot dirty file is loaded on startup
|
// To notify plugins that a snapshot dirty file is loaded on startup
|
||||||
SCNotification scnN;
|
SCNotification scnN2;
|
||||||
scnN.nmhdr.hwndFrom = 0;
|
scnN2.nmhdr.hwndFrom = 0;
|
||||||
scnN.nmhdr.idFrom = (uptr_t)buffer;
|
scnN2.nmhdr.idFrom = (uptr_t)buffer;
|
||||||
scnN.nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
|
scnN2.nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN2);
|
||||||
|
|
||||||
buffer->setLoadedDirty(true);
|
buffer->setLoadedDirty(true);
|
||||||
}
|
}
|
||||||
|
@ -535,13 +535,13 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
|
||||||
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
||||||
|
|
||||||
generic_string args = TEXT("-multiInst");
|
generic_string args = TEXT("-multiInst");
|
||||||
size_t res = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), TEXT("runas"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
size_t shellExecRes = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), TEXT("runas"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
||||||
|
|
||||||
// If the function succeeds, it returns a value greater than 32. If the function fails,
|
// If the function succeeds, it returns a value greater than 32. If the function fails,
|
||||||
// it returns an error value that indicates the cause of the failure.
|
// it returns an error value that indicates the cause of the failure.
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
|
||||||
|
|
||||||
if (res < 32)
|
if (shellExecRes < 32)
|
||||||
{
|
{
|
||||||
_nativeLangSpeaker.messageBox("OpenInAdminModeFailed",
|
_nativeLangSpeaker.messageBox("OpenInAdminModeFailed",
|
||||||
_pPublicInterface->getHSelf(),
|
_pPublicInterface->getHSelf(),
|
||||||
|
@ -579,13 +579,13 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
|
||||||
args += TEXT("\"");
|
args += TEXT("\"");
|
||||||
args += fileNamePath;
|
args += fileNamePath;
|
||||||
args += TEXT("\"");
|
args += TEXT("\"");
|
||||||
size_t res = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), TEXT("runas"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
size_t shellExecRes = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), TEXT("runas"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
||||||
|
|
||||||
// If the function succeeds, it returns a value greater than 32. If the function fails,
|
// If the function succeeds, it returns a value greater than 32. If the function fails,
|
||||||
// it returns an error value that indicates the cause of the failure.
|
// it returns an error value that indicates the cause of the failure.
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
|
||||||
|
|
||||||
if (res < 32)
|
if (shellExecRes < 32)
|
||||||
{
|
{
|
||||||
_nativeLangSpeaker.messageBox("OpenInAdminModeFailed",
|
_nativeLangSpeaker.messageBox("OpenInAdminModeFailed",
|
||||||
_pPublicInterface->getHSelf(),
|
_pPublicInterface->getHSelf(),
|
||||||
|
|
|
@ -471,15 +471,11 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
||||||
LPNMMOUSE lpnm = (LPNMMOUSE)notification;
|
LPNMMOUSE lpnm = (LPNMMOUSE)notification;
|
||||||
if (lpnm->dwItemSpec == DWORD(STATUSBAR_DOC_TYPE))
|
if (lpnm->dwItemSpec == DWORD(STATUSBAR_DOC_TYPE))
|
||||||
{
|
{
|
||||||
POINT p;
|
|
||||||
::GetCursorPos(&p);
|
|
||||||
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
|
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
|
||||||
TrackPopupMenu(hLangMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
|
TrackPopupMenu(hLangMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
|
||||||
}
|
}
|
||||||
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_EOF_FORMAT))
|
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_EOF_FORMAT))
|
||||||
{
|
{
|
||||||
POINT p;
|
|
||||||
::GetCursorPos(&p);
|
|
||||||
MenuPosition & menuPos = getMenuPosition("edit-eolConversion");
|
MenuPosition & menuPos = getMenuPosition("edit-eolConversion");
|
||||||
HMENU hEditMenu = ::GetSubMenu(_mainMenuHandle, menuPos._x);
|
HMENU hEditMenu = ::GetSubMenu(_mainMenuHandle, menuPos._x);
|
||||||
if (!hEditMenu)
|
if (!hEditMenu)
|
||||||
|
|
|
@ -2836,15 +2836,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
|
||||||
if (!isOK)
|
if (!isOK)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// session.xml: Session stock the absolute file path, it should never be on cloud
|
|
||||||
generic_string cloudSessionPath = cloudSettingsPath;
|
|
||||||
PathAppend(cloudSessionPath, TEXT("session.xml"));
|
|
||||||
if (!::PathFileExists(cloudSessionPath.c_str()) && _pXmlSessionDoc)
|
|
||||||
{
|
|
||||||
_pXmlSessionDoc->SaveFile(cloudSessionPath.c_str());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// userDefineLang.xml
|
// userDefineLang.xml
|
||||||
generic_string cloudUserLangsPath = cloudSettingsPath;
|
generic_string cloudUserLangsPath = cloudSettingsPath;
|
||||||
PathAppend(cloudUserLangsPath, TEXT("userDefineLang.xml"));
|
PathAppend(cloudUserLangsPath, TEXT("userDefineLang.xml"));
|
||||||
|
@ -2885,15 +2877,6 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// functionList.xml
|
|
||||||
generic_string cloudFunctionListPath = cloudSettingsPath;
|
|
||||||
PathAppend(cloudFunctionListPath, TEXT("functionList.xml"));
|
|
||||||
if (!::PathFileExists(cloudFunctionListPath.c_str()))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6429,8 +6412,8 @@ void NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & g
|
||||||
|
|
||||||
for (size_t x = 0; x < _pXmlExternalLexerDoc.size(); ++x)
|
for (size_t x = 0; x < _pXmlExternalLexerDoc.size(); ++x)
|
||||||
{
|
{
|
||||||
TiXmlNode *lexersRoot = ( _pXmlExternalLexerDoc[x]->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles"));
|
TiXmlNode* lexersRoot2 = ( _pXmlExternalLexerDoc[x]->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles"));
|
||||||
for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType"));
|
for (TiXmlNode* childNode = lexersRoot2->FirstChildElement(TEXT("LexerType"));
|
||||||
childNode ;
|
childNode ;
|
||||||
childNode = childNode->NextSibling(TEXT("LexerType")))
|
childNode = childNode->NextSibling(TEXT("LexerType")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -834,9 +834,9 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||||
LangType lType = pNppParams->getLangIDFromStr(lexerStyler.getLexerName());
|
LangType lType = pNppParams->getLangIDFromStr(lexerStyler.getLexerName());
|
||||||
if (lType == L_TEXT)
|
if (lType == L_TEXT)
|
||||||
{
|
{
|
||||||
generic_string str = lexerStyler.getLexerName();
|
generic_string lexerNameStr = lexerStyler.getLexerName();
|
||||||
str += TEXT(" is not defined in NppParameters::getLangIDFromStr()");
|
lexerNameStr += TEXT(" is not defined in NppParameters::getLangIDFromStr()");
|
||||||
printStr(str.c_str());
|
printStr(lexerNameStr.c_str());
|
||||||
}
|
}
|
||||||
const TCHAR *kws = pNppParams->getWordList(lType, style._keywordClass);
|
const TCHAR *kws = pNppParams->getWordList(lType, style._keywordClass);
|
||||||
if (!kws)
|
if (!kws)
|
||||||
|
|
|
@ -1106,10 +1106,10 @@ void DockingCont::onSize()
|
||||||
|
|
||||||
|
|
||||||
// get active item data
|
// get active item data
|
||||||
size_t iItemCnt = static_cast<size_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
|
size_t iItemCnt2 = static_cast<size_t>(::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0));
|
||||||
|
|
||||||
// resize visible plugin windows
|
// resize visible plugin windows
|
||||||
for (size_t iItem = 0; iItem < iItemCnt; ++iItem)
|
for (size_t iItem = 0; iItem < iItemCnt2; ++iItem)
|
||||||
{
|
{
|
||||||
tcItem.mask = TCIF_PARAM;
|
tcItem.mask = TCIF_PARAM;
|
||||||
::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem));
|
::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem));
|
||||||
|
|
|
@ -350,7 +350,7 @@ void FunctionListPanel::reload()
|
||||||
|
|
||||||
if (root)
|
if (root)
|
||||||
{
|
{
|
||||||
Buffer* currentBuf = (*_ppEditView)->getCurrentBuffer();
|
currentBuf = (*_ppEditView)->getCurrentBuffer();
|
||||||
const TCHAR *fullFilePath = currentBuf->getFullPathName();
|
const TCHAR *fullFilePath = currentBuf->getFullPathName();
|
||||||
_treeView.setItemParam(root, fullFilePath);
|
_treeView.setItemParam(root, fullFilePath);
|
||||||
TreeParams *previousParams = getFromStateArray(fullFilePath);
|
TreeParams *previousParams = getFromStateArray(fullFilePath);
|
||||||
|
|
|
@ -808,8 +808,6 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case IDC_COLONENUMBER_STATIC:
|
case IDC_COLONENUMBER_STATIC:
|
||||||
{
|
{
|
||||||
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
|
|
||||||
|
|
||||||
NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = pNppParam->getNativeLangSpeaker();
|
||||||
generic_string strNbCol = pNativeSpeaker->getLocalizedStrFromID("edit-verticaledge-nb-col", TEXT("Nb of column:"));
|
generic_string strNbCol = pNativeSpeaker->getLocalizedStrFromID("edit-verticaledge-nb-col", TEXT("Nb of column:"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue