Theme XML files getting borked?



  • I’ve noticed some strange entries appearing in the theme XML files, such as:

    <WordsStyle name="COMMENTLINE" ... >ContentScroller</WordsStyle>
    <WordsStyle name="INSTRUCTION WORD" ... >ooooo</WordsStyle>
    <WordsStyle name="NUMBER" ... >endfunction endif</WordsStyle>
    <WordsStyle name="NUMBER" ... >if else for while</WordsStyle>
    <WordsStyle name="NUMBER" ... >import</WordsStyle>
    <WordsStyle name="STRING RIGHT QUOTE" ... >onMotionChanged onMotionFinished Tween ImagesStrip ContentScroller mx transitions easing Sprite Point MouseEvent Event BitmapData Timer TimerEvent addEventListener event x y height width</WordsStyle>
    

    Are these expected or is it a bug?



  • @supasillyass

    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 
    


  • @supasillyass

    I would give the following a try

    1. stop npp
    2. temporarily rename %APPDATA%\Notepad++
    3. restart npp
    4. check that %APPDATA%\Notepad++ and sub-directories do get recreated and redo
      you tests.


  • @Ekopalypse said:

    @supasillyass

    I would give the following a try

    1. stop npp
    2. temporarily rename %APPDATA%\Notepad++
    3. restart npp
    4. 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).



  • @supasillyass

    copy it over from C:\Program Files (x86)\Notepad++



  • @Ekopalypse said:

    @supasillyass

    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>
    


  • @supasillyass

    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.



  • @supasillyass

    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:

    @supasillyass

    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 and HotFudgeSundae.xml might be the worst offenders.



  • @supasillyass

    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, my bash and Batch keywords got transferred to TCL and Objective-C (QUALIFIER not INSTRUCTION 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. (My langs.xml was pretty old, so I grabbed langs.model.xml from the latest portable version.)