Community
    • Login

    Copy only the not hidden text.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 2.8k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Online
            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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors