Fix tab settings for external lexers cannot be saved issue

Allows the configuration of tab settings for external lexers to be saved through the sessions.

Fix #16460, close #16461
This commit is contained in:
Ekopalypse 2025-04-23 12:56:06 +02:00 committed by Don Ho
parent cfbb4de52a
commit 0ffd606053

View File

@ -8610,6 +8610,26 @@ bool NppParameters::insertTabInfo(const wchar_t* langName, int tabInfo, bool bac
return true;
}
}
for (size_t x = 0; x < _pXmlExternalLexerDoc.size(); ++x)
{
TiXmlNode* langRoot = (_pXmlExternalLexerDoc[x]->FirstChild(L"NotepadPlus"))->FirstChildElement(L"Languages");
for (TiXmlNode* childNode = langRoot->FirstChildElement(L"Language");
childNode;
childNode = childNode->NextSibling(L"Language"))
{
TiXmlElement* element = childNode->ToElement();
const wchar_t* nm = element->Attribute(L"name");
if (nm && lstrcmp(langName, nm) == 0)
{
childNode->ToElement()->SetAttribute(L"tabSettings", tabInfo);
childNode->ToElement()->SetAttribute(L"backspaceUnindent", backspaceUnindent ? L"yes" : L"no");
_pXmlExternalLexerDoc[x]->SaveFile();
return true;
}
}
}
return false;
}