Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Copy only the not hidden text.

    Help wanted · · · – – – · · ·
    3
    4
    130
    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.
    • Kanagi
      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 Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        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 Kilborn 1 Reply Last reply Reply Quote 3
        • Alan Kilborn
          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
          • guy038
            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
            Copyright © 2014 NodeBB Forums | Contributors