Community
    • Login

    Hide horizontal line at folds?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 302 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.
    • 0
      0Villitz
      last edited by

      Is there a way to hide or change the color of the horizontal white line at a folded function/code block?
      aa80ed69-46fc-4e48-a179-4bb3decaaed8-image.png s

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @0Villitz
        last edited by PeterJones

        @0Villitz ,

        Unfortunately, there is not yet a configuration option to allow users to change that color. As mentioned in the Hide Fold Lines discussion, there may be messages that plugins can send – that topic had an example of hidden lines, but I was able to find an equivalent for the fold line: the PythonScript plugin could send

        editor.setElementColour(ELEMENT.FOLD_LINE, (0,0,255,255))
        

        where the color is (RED,GREEN,BLUE,ALPHA) where ALPHA should be 255

        here’s the results of me running that command in PythonScript 3:
        dd61ca72-575e-4a11-92d2-440a75a20b09-image.png

        and then I changed it to GREEN instead of BLUE:

        editor.setElementColour(ELEMENT.FOLD_LINE, (0,255,0,255))
        

        cd974739-3173-49bb-b3f3-8859f56ffe3b-image.png

        And hiding it completely can be done by either setting the ALPHA to 0, or editor.setFoldFlags(0) in PythonScript (or the equivalent, as shown in that other discussion, in NppExec or other such plugin)

        This feature was requested in 2023, but neither the developer nor any other volunteers have apparently put in a PR to implement it. I’ve just “bumped” the discussion, with links to a few related discussions here; if you’d like to go upvote that, and/or put in your 2cents, that might encourage someone to put in the effort.

        V 1 Reply Last reply Reply Quote 4
        • V
          Victorel Petrovich @PeterJones
          last edited by Victorel Petrovich

          @PeterJones said in Hide horizontal line at folds?:

          editor.setElementColour(ELEMENT.FOLD_LINE, (0,0,255,255))
          where the color is (RED,GREEN,BLUE,ALPHA)
          …
          And hiding it completely can be done by either setting the ALPHA to 0

          Yes, surprisingly this works.
          While:

          or editor.setFoldFlags(0) in PythonScript

          no, not by itself: it would leave behind a green line as if text were hidden with View/Hide Lines . As the other thread showed, that command would need to be followed by additional commands to set the Alpha of those “hidden lines’line” to 0. The full equivalent in Python would be:

          editor.setFoldFlags(0)
          old_col=editor.getElementColour(ELEMENT.HIDDEN_LINE )
          new_col=old_col[:3]+(0,) # 0 for alpha, to hide; 255 to show 
          editor.setElementColour(ELEMENT.HIDDEN_LINE, new_col)
          

          I find it puzzling that the latter solution requires further changing the "hidden lines’ line " colour, while:
          editor.setElementColour(ELEMENT.FOLD_LINE, (x,x,x,0))
          is enough by itself.
          At first I thought it’s a PythonScript behind the scenes trick, but it works in NppExec too, for example with:
          SCI_SENDMSG SCI_SETELEMENTCOLOUR SC_ELEMENT_FOLD_LINE 0x00000000
          (the relevant Alpha part is the first 2 0s , making color transparent/invisible).

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