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.
    • KanagiK
      Kanagi
      last edited by

      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

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Kanagi
        last edited by Alan Kilborn

        @kanagi

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

        Alan KilbornA 1 Reply Last reply Reply Quote 3
        • Alan KilbornA
          Alan Kilborn @Alan Kilborn
          last edited by

          @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
          • guy038G
            guy038
            last edited by

            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors