Community
    • Login

    Break a string by delete paired quote will unfold folded codes in some language highlight

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 121 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.
    • byzodB
      byzod
      last edited by

      I’m using a highlighting for AutoHotkey, something is bothering me: when breaking a string while editing code, all folded code below it will be unfolded

      After some test that I found that not all languages behaves like this, some won’t

      For example:

      • Built-in Javascript highlighting will not unfold folded codes when breaking a string
      • Built-in Rust will
      • Built-in Perl will

      Using this code, highlighting with said languages, fold all functions and delete the ending quote of the string a then see what happens

      function foo(bar){
      	/* blah */
      }
      
      a := "test"
      
      function foo2(bar){
      	/* blahblah */
      }
      
      function foo3(bar){
      	/* blahblah */
      }
      

      demo:
      alt text

      What cause this difference? How can I improve the UDL to act like Javascript highlighting?

      PeterJonesP 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @byzod
        last edited by PeterJones

        demo:
        alt text

        imgur doesn’t like our forum for some reason, and blocks us from embedding their images.

        please just paste any images directly in the forum, rather than trying to make use of that external host. (for animated gifs, like this one, you might have to drag the file from your Explorer window into your post, but it should upload properly):

        ndaCupD.gif

        byzodB 1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones @byzod
          last edited by

          @byzod said in Break a string by delete paired quote will unfold folded codes in some language highlight:

          What cause this difference?

          Every built-in language references a specific Lexer, and each Lexer is coded separately (and often by different people).

          And UDL is a separate lexer from every built-in language.

          How can I improve the UDL to act like Javascript highlighting?

          You cannot. The behavior of the folding for each language is compiled into the program, and cannot be affected by the end user.

          You could, in theory, report the bug to the Notepad++ developer (see our FAQ on reporting bugs), but UDL bugs almost never get fixed, and there have been some long-standing ones reported years ago that are still open (and much more annoying that just unfolding a block when you type near the block). Sorry to be the bearer of bad news.

          byzodB 1 Reply Last reply Reply Quote 1
          • byzodB
            byzod @PeterJones
            last edited by

            @PeterJones thanks I tried to upload but didn’t found such button :D

            1 Reply Last reply Reply Quote 0
            • byzodB
              byzod @PeterJones
              last edited by

              @PeterJones said in Break a string by delete paired quote will unfold folded codes in some language highlight:

              @byzod said in Break a string by delete paired quote will unfold folded codes in some language highlight:

              What cause this difference?

              Every built-in language references a specific Lexer, and each Lexer is coded separately (and often by different people).

              And UDL is a separate lexer from every built-in language.

              How can I improve the UDL to act like Javascript highlighting?

              You cannot. The behavior of the folding for each language is compiled into the program, and cannot be affected by the end user.

              You could, in theory, report the bug to the Notepad++ developer (see our FAQ on reporting bugs), but UDL bugs almost never get fixed, and there have been some long-standing ones reported years ago that are still open (and much more annoying that just unfolding a block when you type near the block). Sorry to be the bearer of bad news.

              Glad to found out why though

              btw I found a workaound fortunately: enable the auto pairs for () [] {} "" etc, then it won’t trigger this bug, mostly. Sometimes still bomb all codes out but it improves the experience a lot already

              mpheathM 1 Reply Last reply Reply Quote 3
              • mpheathM
                mpheath @byzod
                last edited by

                @byzod

                This issue mentions about the unfolding that can happen with numerous lexers.

                https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12121

                I posted a LuaScript script in a comment in that thread that trades the behavior for another behavior by changing the editor.AutomaticFold setting temporarily in the 2nd script. Certain characters will set the automatic folding off which changes the header fold lines to become invisible sections and back again once continue editing. It is not a solution but rather a swap of side-effects to help to keep the current fold state.

                I have little knowledge of AutoHotkey syntax and it’s UDL issues so at the moment cannot offer an updated LuaScript script for calling editor.AutomaticFold.

                The objective-c lexer seems unaffected with /* multi-line comments and not sure why yet compared to looking at the lexers source code. Obviously the styling continues on past the folding though why it does not open the folds seems like possibly the folding is delayed in some lexers and so like the LuaScript script does is to cause a delay though that is just a theory at the moment.

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