Fix Find/Replace history lost issue

Retain find history if config file value set too large

Fix #323, close #8168
This commit is contained in:
Scott Sumner 2020-04-24 09:53:53 -04:00 committed by Don HO
parent 4be846e7ea
commit fbf6668a80
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -2243,6 +2243,10 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
if (!findHistoryRoot) return; if (!findHistoryRoot) return;
(findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryPath"), &_findHistory._nbMaxFindHistoryPath); (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryPath"), &_findHistory._nbMaxFindHistoryPath);
if (_findHistory._nbMaxFindHistoryPath > NB_MAX_FINDHISTORY_PATH)
{
_findHistory._nbMaxFindHistoryPath = NB_MAX_FINDHISTORY_PATH;
}
if ((_findHistory._nbMaxFindHistoryPath > 0) && (_findHistory._nbMaxFindHistoryPath <= NB_MAX_FINDHISTORY_PATH)) if ((_findHistory._nbMaxFindHistoryPath > 0) && (_findHistory._nbMaxFindHistoryPath <= NB_MAX_FINDHISTORY_PATH))
{ {
for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Path")); for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Path"));
@ -2258,6 +2262,10 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
} }
(findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryFilter"), &_findHistory._nbMaxFindHistoryFilter); (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryFilter"), &_findHistory._nbMaxFindHistoryFilter);
if (_findHistory._nbMaxFindHistoryFilter > NB_MAX_FINDHISTORY_FILTER)
{
_findHistory._nbMaxFindHistoryFilter = NB_MAX_FINDHISTORY_FILTER;
}
if ((_findHistory._nbMaxFindHistoryFilter > 0) && (_findHistory._nbMaxFindHistoryFilter <= NB_MAX_FINDHISTORY_FILTER)) if ((_findHistory._nbMaxFindHistoryFilter > 0) && (_findHistory._nbMaxFindHistoryFilter <= NB_MAX_FINDHISTORY_FILTER))
{ {
for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Filter")); for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Filter"));
@ -2273,6 +2281,10 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
} }
(findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryFind"), &_findHistory._nbMaxFindHistoryFind); (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryFind"), &_findHistory._nbMaxFindHistoryFind);
if (_findHistory._nbMaxFindHistoryFind > NB_MAX_FINDHISTORY_FIND)
{
_findHistory._nbMaxFindHistoryFind = NB_MAX_FINDHISTORY_FIND;
}
if ((_findHistory._nbMaxFindHistoryFind > 0) && (_findHistory._nbMaxFindHistoryFind <= NB_MAX_FINDHISTORY_FIND)) if ((_findHistory._nbMaxFindHistoryFind > 0) && (_findHistory._nbMaxFindHistoryFind <= NB_MAX_FINDHISTORY_FIND))
{ {
for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Find")); for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Find"));
@ -2288,6 +2300,10 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
} }
(findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryReplace"), &_findHistory._nbMaxFindHistoryReplace); (findHistoryRoot->ToElement())->Attribute(TEXT("nbMaxFindHistoryReplace"), &_findHistory._nbMaxFindHistoryReplace);
if (_findHistory._nbMaxFindHistoryReplace > NB_MAX_FINDHISTORY_REPLACE)
{
_findHistory._nbMaxFindHistoryReplace = NB_MAX_FINDHISTORY_REPLACE;
}
if ((_findHistory._nbMaxFindHistoryReplace > 0) && (_findHistory._nbMaxFindHistoryReplace <= NB_MAX_FINDHISTORY_REPLACE)) if ((_findHistory._nbMaxFindHistoryReplace > 0) && (_findHistory._nbMaxFindHistoryReplace <= NB_MAX_FINDHISTORY_REPLACE))
{ {
for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Replace")); for (TiXmlNode *childNode = findHistoryRoot->FirstChildElement(TEXT("Replace"));