Fix "Follow Windows" option makes external lexers show twice in tab settings

Fix #16462
This commit is contained in:
Don Ho 2025-07-15 21:10:30 +02:00
parent a6cd3de8a7
commit f234207f5d
3 changed files with 8 additions and 5 deletions

View File

@ -287,7 +287,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const wchar_t *cmdL
if (doesFileExist(themePath.c_str())) if (doesFileExist(themePath.c_str()))
{ {
nppGUI._themeName.assign(themePath); nppGUI._themeName.assign(themePath);
nppParams.reloadStylers(themePath.c_str()); nppParams.reloadStylers(themePath.c_str(), false);
::SendMessage(_hSelf, WM_UPDATESCINTILLAS, TRUE, 0); ::SendMessage(_hSelf, WM_UPDATESCINTILLAS, TRUE, 0);
} }
} }

View File

@ -1043,7 +1043,7 @@ NppParameters::~NppParameters()
} }
bool NppParameters::reloadStylers(const wchar_t* stylePath) bool NppParameters::reloadStylers(const wchar_t* stylePath, bool doReloadLexerPlugins /*= true*/)
{ {
delete _pXmlUserStylerDoc; delete _pXmlUserStylerDoc;
@ -1077,9 +1077,12 @@ bool NppParameters::reloadStylers(const wchar_t* stylePath)
getUserStylersFromXmlTree(); getUserStylersFromXmlTree();
// Reload plugin styles. // Reload plugin styles.
for ( size_t i = 0; i < getExternalLexerDoc()->size(); ++i) if (doReloadLexerPlugins)
{ {
getExternalLexerFromXmlTree( getExternalLexerDoc()->at(i) ); for (size_t i = 0; i < getExternalLexerDoc()->size(); ++i)
{
getExternalLexerFromXmlTree(getExternalLexerDoc()->at(i));
}
} }
return true; return true;
} }

View File

@ -1524,7 +1524,7 @@ public:
bool load(); bool load();
bool reloadLang(); bool reloadLang();
bool reloadStylers(const wchar_t *stylePath = nullptr); bool reloadStylers(const wchar_t* stylePath = nullptr, bool doReloadLexerPlugins = true);
void destroyInstance(); void destroyInstance();
std::wstring getSettingsFolder(); std::wstring getSettingsFolder();