Community
    • Login

    User defined language - operator § not working

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 2 Posters 12 Views 2 Watching
    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.
    • arnaud deretteA Online
      arnaud derette
      last edited by

      flyn operator §.png
      Hi,
      I am using the user defined language since a long time, on a personal language i’m developing named flyn.
      Recently, i added a new operator to the language : §
      But syntax high-lighting is not working on it (see screenshot).
      I suspect it is because it’s a multi-byte UTF8 character.
      Can anyone confirm ?
      (and correct if possible)

      Cheers
      Have a nice summer everyone.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @arnaud derette
        last edited by PeterJones

        @arnaud-derette said:

        I suspect it is because it’s a multi-byte UTF8 character.
        Can anyone confirm ?

        Correct.

        Due to implementation details, UTF8 might work in the “separators required” operator 2 list, but it does not in the operators 1 list. (It’s because of the “forwards” vs “backwards” differences, as described here – under the hood, that means the non-separators-required doesn’t see it correctly).

        (and correct if possible)

        Not any time soon: UDL was not designed with multi-byte encodings in mind. (I tried looking into the poor UTF8 support in UDL a year or two ago, and got so lost, I haven’t tried to dive back in. And the developer has made it clear after a decade of ignored feature requests that UDL is ‘good enough’ in his opinion.)

        If you didn’t need to cozy the § next to the text, then a workaround would be to move § to the operator 2 list.

        27745250-0449-4062-ba6e-2ad8bb766931-image.jpeg

        But because you want it to work on parent§, that won’t work for you.

        Instead, I would suggest using EnhanceAnyLexer plugin, and setting the foreground color for the regex that matches the § character. Here’s an example where I set the 0xBBGGRR (*) to 0xFF00FF, and match on the §. And this is showing it works

        07936c4f-bccc-4898-b3f2-6c52cb8f8b65-image.jpeg

        For a UDL named “flyn”, The EnhanceAnyLexer.ini would need to contain:

        [flyn]
        0xFF00FF = §
        

        (using Plugins > EnhanceAnyLexer > Enhance This Lexer will open the config in the right place, and will create the section for your active language or UDL if that section isn’t already in the INI, and will move to that section if it is already in the INI)

        This sets the regex matching § to be magenta (blue and red at full intensity).

        (*: yes, the order is reversed from most RGB words, so BLUE is the upper two nybbles; thank you MS)

        arnaud deretteA 1 Reply Last reply Reply Quote 0
        • arnaud deretteA Online
          arnaud derette @PeterJones
          last edited by

          Hi @PeterJones

          Thanks for the quick answer.
          I does not work in the operator 2 list either (or may be i need to do something more than just put § there ?)

          It’s not that important, so i will keep the plugin solution for another time.

          Thank you again.
          Cheers

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP Online
            PeterJones @arnaud derette
            last edited by

            @arnaud-derette said:
            I does not work in the operator 2 list either (or may be i need to do something more than just put § there ?)

            Like I said, because you want the § to not have spaces, like in parent§.D, it won’t work for you. § in operators 2 will only work if you can have spaces around the §

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors