• Login
Community
  • Login

Copy only the not hidden text.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 1.4k 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.
  • K
    Kanagi
    last edited by Jun 15, 2022, 5:36 PM

    Hey, im trying to find out if there is a way to Copy every text in my file except for the ones i have hidden with ALT + H, if i copy them it also takes all the text thats hidden.
    Thanks in advance

    A 1 Reply Last reply Jun 15, 2022, 5:48 PM Reply Quote 0
    • A
      Alan Kilborn @Kanagi
      last edited by Alan Kilborn Jun 15, 2022, 5:49 PM Jun 15, 2022, 5:48 PM

      @kanagi

      Currently there is no way to do that without scripting. Hidden lines isn’t a fully fleshed-out feature in Notepad++.

      A 1 Reply Last reply Jun 15, 2022, 8:11 PM Reply Quote 3
      • A
        Alan Kilborn @Alan Kilborn
        last edited by Jun 15, 2022, 8:11 PM

        @alan-kilborn said in Copy only the not hidden text.:

        Currently there is no way to do that without scripting

        Maybe something like this:

        line_list = []
        (start_line, end_line) = editor.getUserLineSelection()
        for L in range(start_line, end_line + 1):
            if editor.getLineVisible(L):
                line_list.append(editor.getLine(L))
        text = ''.join(line_list)
        editor.copyText(text)
        

        Note that Scintilla doesn’t do a great job distinguishing lines hidden by code folding and lines hidden by the user, so if you have lines where folding is collapsed, they will NOT be copied by that script code.

        1 Reply Last reply Reply Quote 2
        • G
          guy038
          last edited by Jun 15, 2022, 8:54 PM

          Hello @kanagi, @alan-kilborn and All,

          In addition to the Alan’s python script, I advice you to read this post first

          Then, if not confidential, you could share with us some text with possible hidden parts and we’ll probably be able to find out some regexes to bookmark the non-hidden sections or the hiden ones !

          See you later,

          Best Regards

          guy038

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