• Login
Community
  • Login

Hide/Unhide Non-Bookmarked Lines

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 Posters 6.3k 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.
  • M
    Mike Smith
    last edited by Mar 6, 2020, 7:04 PM

    Hello,

    Is there any way to hide and unhide all non-bookmarked lines?

    Thank you

    E A 2 Replies Last reply Mar 6, 2020, 7:42 PM Reply Quote 0
    • E
      Ekopalypse @Mike Smith
      last edited by Mar 6, 2020, 7:42 PM

      @Mike-Smith

      afaik, not as builtin feature.
      A possible solution might be to use a scripting language plugin
      and some code similar to the pythonscript below.

      from Npp import editor
      
      bookmark_mask = 1<<24
      line = 0
      while True:
          line = editor.markerNext(line, bookmark_mask)
          if line == -1:
              break
          editor.hideLines(line,line)
          line+=1
      

      This is just some demo code demonstrating the feature.

      1 Reply Last reply Reply Quote 2
      • A
        Alan Kilborn @Mike Smith
        last edited by Alan Kilborn Mar 6, 2020, 7:49 PM Mar 6, 2020, 7:48 PM

        @Mike-Smith

        The hide lines feature in Notepad++ is “underdeveloped”; I’d stay away from it unless and until it is made better by the developers. BUT…I can see how what you want to do is valuable.

        @Ekopalypse OP wanted to hide NON bookmarked lines but AFAICT at a quick look, your P.S. will hide the bookmarked lines instead?

        E 1 Reply Last reply Mar 6, 2020, 7:52 PM Reply Quote 3
        • E
          Ekopalypse @Alan Kilborn
          last edited by Mar 6, 2020, 7:52 PM

          @Alan-Kilborn
          you are correct and I thought is on bookmarked lines really correct?
          Well, non-bookmarked makes sense :-)
          Let’s see if OP wants to go that way.

          1 Reply Last reply Reply Quote 0
          • M
            Mike Smith
            last edited by Mar 7, 2020, 9:16 AM

            @Ekopalypse, @Alan-Kilborn Thank you both for your input.

            I do indeed wish to hide non-bookmarked lines. Although the code above seems to hide bookmarked lines only - and I don’t know how to unhide them either.

            The reasoning is that I have a large database which contains over 24,000 download links - one per line, and I need to go through the painful task of editing each one of them. (I can’t see any other way to modify filenames on one server & modifying the respective link on another server at the same time!)

            So to assist with the work, I can highlight all the download links by bookmarking them, and then hiding all other information, which would allow me to sift through the links easier.

            A 1 Reply Last reply Mar 7, 2020, 2:24 PM Reply Quote 0
            • A
              Alan Kilborn @Mike Smith
              last edited by Mar 7, 2020, 2:24 PM

              @Mike-Smith said in Hide/Unhide Non-Bookmarked Lines:

              I need to go through the painful task of editing each one of them

              24000 things to examine and edit is a huge manual task. Perhaps if you elaborate a bit more and/or show some data, someone here might have some automation hints for you? Maybe it isn’t possible…but hopefully something could be done.

              and I don’t know how to unhide them either.

              As far as I know, Notepad++'s menus only offers a “Hide Lines”. After you’ve done that one or more times, you’ll see some arrows in the margin, example:

              a874f139-d0df-4aff-a6e8-532b71d7acde-image.png

              So the way to “unhide” these lines is to click on one of the green arrows. If you have a script that hides a lot of lines, showing them all again when desired is problematic because you’d have to click on a lot of green arrows. At that point the better way would be to simply restart Notepad++ (which doesn’t remember the status of hidden lines when exited and re-run).

              I do indeed wish to hide non-bookmarked lines

              It seems like you could run your bookmarking operation, then do a “Inverse Bookmark” command, and then run the script @Ekopalypse provided…to get what you want?

              M 1 Reply Last reply Mar 7, 2020, 7:50 PM Reply Quote 2
              • M
                Mike Smith @Alan Kilborn
                last edited by Mar 7, 2020, 7:50 PM

                @Alan-Kilborn

                It seems like you could run your bookmarking operation, then do a “Inverse Bookmark” command, and then run the script @Ekopalypse provided…to get what you want?

                Yes, that’s a good idea! I did just that, and it hid everything I didn’t need to edit. Thank you.

                24000 things to examine and edit is a huge manual task.

                I don’t thing it’s something that can be automated though. The issue is that I have all the download links in one database (which I’m editing through Notepad++), and the files are stored on a seperate server. The task I am currently processing, is to randomize all filenames:

                https://www.example.com/74547854787fileone.zip
                https://www.example.com/56647979548filetwo.zip
                https://www.example.com/01324679462filethree.zip
                https://www.example.com/64647452105filefour.zip
                

                So not only do I need to complete the task of randomizing the filenames (A task I’m achieving using Bulk Rename Utility), I have to then ensure the download links are changed to represent the relevant filename.

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