[UDL] Code fold get incrementally out of alignment.

  • 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?

  • 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…

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

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

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

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

Log in to reply