• Login
Community
  • Login

[UDL] Code fold get incrementally out of alignment.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 4 Posters 4.4k 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.
  • S
    Samuel Hawarden
    last edited by Oct 27, 2015, 3:34 AM

    I have a User Define Language that defines only { and } for folding. Comment folding is disabled.

    The 1st fold is the outer fold (0 deep), all encompassing and lines up perfectly. It starts and stops on the same line as the first and last curly bracket that define the fold region. Collapsing it shows the 1st line only

    But between them, the folds move down from where they’re supposed to be.

    The 2nd fold is 1 fold deep within the 1st fold and is visible and operates at one line below the curly brackets that define it. The fold hides the line AFTER the curly, sometimes hiding code that’s outside the curled-region.

    The 3rd fold is also 1 fold deep and folds at 2 lines below the curly pair. This leave the the lines immediately below the curly visible and hides 2 lines under the close curly.

    The 4th fold is 2 folds deep, contained within the 3rd curly pair and is also 2 lines below the curly.

    The 5th fold is 1 deep again and is 3 lines below the corresponding curlies.

    The farther down I go the worse it gets.

    If I switch to say C or one of the other pre-defined languages that use the curly brackets, the folding lines up perfectly. If I then switch back to the UDL any n>1 folds are even farther out of alignment.

    Is there anything I can do to re-align them short of editing the primary language definition file?

    1 Reply Last reply Reply Quote 0
    • J
      Jim Dailey
      last edited by Oct 27, 2015, 1:55 PM

      It might be that your UDL description is causing some { or } to be interpreted differently than you think it should. For example, I have seen issues like this when I use { or } in a regular expression in an AWK script and I haven’t written the regular expression in such a way that the UDL understands it is a regular expression.

      When you have this issue, search for the next } and see if you can tell how the UDL is/should be interpreting it…

      1 Reply Last reply Reply Quote 0
      • S
        Samuel Hawarden
        last edited by Oct 28, 2015, 11:10 PM

        I’ve checked the code and cannot find any instance of stray brackets that might cause this.

        Even if it was that, the fold points should still line up with something meaningful right?

        Instead they’re just shifted down 1, 2, 3… lines.

        1 Reply Last reply Reply Quote 0
        • J
          Jim Dailey
          last edited by Oct 29, 2015, 2:07 PM

          SH> Even if it was that, the fold points should still line up with something meaningful right?

          Yes, that’s right. When I mess up they still fold on a “}” character, just not the correct one.

          I assume this only happens for user-defined languages, perhaps only this one UDL you have created. If that’s true, perhaps Loreia can help you. Not entirely sure how to get in contact, but if you go to http://udl2.weebly.com you can find UDL documentation and also a form to submit comments.

          1 Reply Last reply Reply Quote 0
          • A
            Alf Coltrane
            last edited by Nov 11, 2015, 10:53 AM

            It seems that it could be an issue with the style of the end of lines. I’m editting files directly from a Linux server (by using NppFTP) and it happens the same to me, but when I change the end of line of the document to Windows the folding draws itself and works as expected. If I change it back to Unix the folding lines get messed instantly. The last update of http://udl2.weebly.com is pretty old (as of 2012), so if it’s not a bug in Notepad++ maybe it’ll be hard to make it work.

            1 Reply Last reply Reply Quote 1
            • M
              Michael Noone
              last edited by Feb 4, 2021, 4:09 PM

              Replying to this as this showed up in Google - I know this is very old, but this solved my problem where when I added a comment block, it then the folding was not aligned with the foldable elements.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors