Community
    • Login

    Syntax highlighting: works for a time, then (irreproducibly) "bleeds", only restarting npp fixes it

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    10 Posts 3 Posters 930 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • El GrecoE
      El Greco
      last edited by

      For years I had no problems with syntax highlighting in a user defined language. A few months ago I had to re-install npp and in v7.9.1 and v7.9.3 I have the following behaviour: for a certain time everything behaves as normal. After a while, seemingly randomly, part of my code is coloured as a comment (code which is not a comment).

      Sometimes it is only the line that I am editing, sometimes it is from the cursor to the next /* in my code.

      The only remedy I found is exiting npp, restarting it and typically within half an hour the problem reoccurs.

      Has anyone experienced the same? Could it be caused by the user defined language?

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @El Greco
        last edited by

        @El-Greco

        Not exactly as you described, but kind of similar.
        For me, the problem was that my code had different EOLs, namely Windows CRLF and Linux LF.
        Once I made sure it was the same, I had no more problems.

        1 Reply Last reply Reply Quote 1
        • El GrecoE
          El Greco
          last edited by

          Thanx for the suggestion. I checked it, but it seems that I only use Windows CRLF in my code.

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE
            Ekopalypse @El Greco
            last edited by Ekopalypse

            @El-Greco

            hmm … sorry, obvious question, did the udl change as well?
            Mind sharing the UDL and some sample code?

            1 Reply Last reply Reply Quote 0
            • EkopalypseE
              Ekopalypse
              last edited by Ekopalypse

              @El-Greco said in Syntax highlighting: works for a time, then (irreproducibly) "bleeds", only restarting npp fixes it:

              Could it be caused by the user defined language?

              Yes, of course it could be - maybe a bug/feature!?

              1 Reply Last reply Reply Quote 0
              • ludamo 0L
                ludamo 0
                last edited by

                I have had this problem for a while with AutoHotkey UDL and only recently tried to fix it. Going to the UDL Dialog and inserting ((EOL)) in the Close: box for single line comments seems to have helped - though I have only been using it for a day or two since the change. But you can see in the Notepad++ margin a fold line appear or disappear depending on the setting. Also using (( " EOL )) in the Close: box for text on the Operators & Delimiters tab may also help though I haven’t tried this.
                If this all fails I found the Ctrl+R (Reload from Disk) corrected the highlighting.

                El GrecoE 1 Reply Last reply Reply Quote 3
                • El GrecoE
                  El Greco @ludamo 0
                  last edited by

                  @ludamo-0
                  Very interesting suggestion, I have implemented it and so far, so good…!
                  (although according to Murphy’s Law it is dangerous to mention it)
                  I will try it now for a week and then report about it here.

                  El GrecoE 1 Reply Last reply Reply Quote 1
                  • El GrecoE
                    El Greco @El Greco
                    last edited by

                    @El-Greco
                    Well, using ((EOL)) seems to improve it, but the issue still remains (although the behaviour is slightly different). I wonder, I am using the same UDL as before, with a much older version of npp (v6.x.y, I forgot which one) without ever having this problem. This problem started when I updated to npp v7.9.1 and v7.9.3 behaves the same.
                    The CTRL+R shortcut is a good one, then at least I can reset the view.

                    1 Reply Last reply Reply Quote 0
                    • ludamo 0L
                      ludamo 0
                      last edited by ludamo 0

                      Well I sympathize with you, my AutoHotkey folding was all over the place as well as the original issue and so I tried a few random things without much success BUT I did have some improvement / success with doing 2 last things:

                      1. moving my userDefinedLang.xml file from …AppData\Roaming\Notepad++\ (I think - although it could have been in C:\Program Files\Notepad++) to …AppData\Roaming\Notepad++\userDefineLangs\ (as well as splitting the individual UDLs into separate files - I had 2 in the original file)
                      2. Unselecting “Allow folding in comments” then restarting Notepad++ then Selecting it again.

                      I haven’t used it enough since to say whether things are cured but here’s hoping.

                      1 Reply Last reply Reply Quote 1
                      • ludamo 0L
                        ludamo 0
                        last edited by ludamo 0

                        Since experimenting further with the AutohotKey UDL I have found that this syntax “bleeding” can be limited / minimised / corrected by adding a space to the end of lines (I normally am a heavy user of tabs) especially those lines which seem to end a certain type of highlighting e.g. comments or lines with delimited strings in them.

                        I also made another discovery, that a tab can be used as a delimiter in UDL. You can enter it by pressing Control+Tab between 2 spaces e.g. ((space tab space EOL)).

                        1 Reply Last reply Reply Quote 2
                        • ludamo 0L ludamo 0 referenced this topic on
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors