Theme XML files getting borked?
-
In which file did you see this?
Can you post your debug-info, which is available from ? menu, the last menu item? -
Most of the
%APPDATA%\Notepad++\themes\*.xml
files. It seems to be caused by using the Style Configurator to save changes.Debug Info:
Notepad++ v7.7.1 (32-bit) Build time : Jun 16 2019 - 21:14:50 Path : C:\Program Files (x86)\Notepad++\notepad++.exe Admin mode : OFF Local Conf mode : OFF OS : Windows 7 (64-bit) Plugins : ColorPicker.dll ComparePlugin.dll DSpellCheck.dll HexEditor.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppCalc.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll NppQCP.dll NppSaveAsAdmin.dll NppTextFX.dll XMLTools.dll _CustomizeToolbar.dll
-
I would give the following a try
- stop npp
- temporarily rename %APPDATA%\Notepad++
- restart npp
- check that %APPDATA%\Notepad++ and sub-directories do get recreated and redo
you tests.
-
@Ekopalypse said:
I would give the following a try
- stop npp
- temporarily rename %APPDATA%\Notepad++
- restart npp
- check that %APPDATA%\Notepad++ and sub-directories do get recreated and redo
you tests.
The
themes
folder doesn’t get recreated, leaving just the default theme (stylers.xml
). -
copy it over from C:\Program Files (x86)\Notepad++
-
@Ekopalypse said:
copy it over from C:\Program Files (x86)\Notepad++
It’s not there. I’m guessing it gets created at installation. I did, however, try it with the portable version and it does occur:
<LexerType name="actionscript" desc="ActionScript" ext=""> <WordsStyle name="TYPE WORD" ... >onMotionChanged onMotionFinished Tween ImagesStrip ContentScroller mx transitions easing Sprite Point MouseEvent Event BitmapData Timer TimerEvent addEventListener event x y height width</WordsStyle>
-
that is correct if one specified user defined keywords in an keyword tag like
in actionscript the “TYPE WORD” is but “COMMENTLINE” is not and
I don’t have any additional word in any of my themes.xml in any of the “COMMENTLINE” tags. -
Ok, in addition to the known fact that the themes are not up to date with the default style
some of them seem to have invalid data, meaning having string content in non-keyword tokens.
I do have a FR which, when gets accepted, could be used to cleanup those data as well. -
@Ekopalypse said:
Ok, in addition to the known fact that the themes are not up to date with the default style
some of them seem to have invalid data, meaning having string content in non-keyword tokens.
I do have a FR which, when gets accepted, could be used to cleanup those data as well.I think this might be the source of the problem, with the invalid data getting propagated across to the different styles. (If I clean up one style XML file directly, the invalid data creeps back in after playing around with the Style Configurator.)
-
Edit:
Bespin.xml
,Choco.xml
andHotFudgeSundae.xml
might be the worst offenders. -
Haven’t verified the source code but from what you are telling I assume that npp loads it
on startup and keeps it in memory, meaning, when you stop npp and edit the xml with a
different editor it might not get repopulated. -
I tried sanitising the theme files by getting the default set from portable Notepad++ and using grepWin to replace
">.*<\/WordsStyle>"
with" \/>"
. However, the files still get borked because the LexerTypes vary between the themes (ordering also seems to matter). So, when I changed from Obsidian to Black board, mybash
andBatch
keywords got transferred toTCL
andObjective-C
(QUALIFIER
notINSTRUCTION WORD
). -
Yes, as I’ve mentioned in this FR themes and default style aren’t in sync. So an automate way must
read the default xml and compare tags against the theme files and act accordingly.
Unfortunately @donho hadn’t time to have a look or maybe he has something different in mind, like changing the way themes are currently used. -
A kludgy fix is to make the theme XML files read-only and add new keywords directly to
langs.xml
, using a different text editor. (Mylangs.xml
was pretty old, so I grabbedlangs.model.xml
from the latest portable version.)