• Login
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 936 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.
  • E
    El Greco
    last edited by Feb 17, 2021, 3:50 PM

    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?

    E 1 Reply Last reply Feb 17, 2021, 3:53 PM Reply Quote 0
    • E
      Ekopalypse @El Greco
      last edited by Feb 17, 2021, 3:53 PM

      @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
      • E
        El Greco
        last edited by Feb 17, 2021, 3:56 PM

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

        E 1 Reply Last reply Feb 17, 2021, 3:58 PM Reply Quote 0
        • E
          Ekopalypse @El Greco
          last edited by Ekopalypse Feb 17, 2021, 3:58 PM Feb 17, 2021, 3:58 PM

          @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
          • E
            Ekopalypse
            last edited by Ekopalypse Feb 17, 2021, 3:59 PM Feb 17, 2021, 3:59 PM

            @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
            • L
              ludamo 0
              last edited by Feb 18, 2021, 2:07 AM

              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.

              E 1 Reply Last reply Feb 18, 2021, 9:09 AM Reply Quote 3
              • E
                El Greco @ludamo 0
                last edited by Feb 18, 2021, 9:09 AM

                @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.

                E 1 Reply Last reply Feb 22, 2021, 8:29 AM Reply Quote 1
                • E
                  El Greco @El Greco
                  last edited by Feb 22, 2021, 8:29 AM

                  @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
                  • L
                    ludamo 0
                    last edited by ludamo 0 Feb 22, 2021, 11:50 PM Feb 22, 2021, 11:48 PM

                    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
                    • L
                      ludamo 0
                      last edited by ludamo 0 Apr 14, 2021, 12:02 AM Apr 14, 2021, 12:00 AM

                      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
                      • L ludamo 0 referenced this topic on Nov 23, 2021, 4:35 AM
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors