• Login
Community
  • Login

Save Search Results with Highlighting

Scheduled Pinned Locked Moved General Discussion
8 Posts 3 Posters 5.2k 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.
  • C
    cipher-1024
    last edited by Jun 5, 2018, 7:44 PM

    Is there any way to copy the results of a “find in files” search and retain the highlighting? Ctrl-C saves all the data I want, but not the handy highlighting (green file name, yellow hits). Even a python method would be great. NPPExport ignores the results window and only grabs things from the document window. I thought I saw a post about this at one time, but my google-foo must be weak because I can’t find anything.

    C 1 Reply Last reply Jun 6, 2018, 12:54 AM Reply Quote 0
    • A
      AZJIO AZJIO
      last edited by Jun 5, 2018, 10:53 PM

      Import a new syntax with highlighting
      https://pastebin.com/ZeWQRppr

      I can give a black theme

      1 Reply Last reply Reply Quote 1
      • C
        Claudia Frank @cipher-1024
        last edited by Jun 6, 2018, 12:54 AM

        @cipher-1024

        quick_and_dirty_python_lexer

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 2
        • C
          cipher-1024
          last edited by Jun 6, 2018, 2:40 AM

          @AZJIO-AZJIO ,
          Thanks for the UDL! I can easily “MARK” the search criteria and be good to go. I must be getting old because I’m not groovy enough for a dark theme (you kids still say groovy, don’t you?). Thanks for posting, I’m keeping that in my UDL list.

          @Claudia-Frank ,
          Quick and dirty is my middle name. Your script works perfectly on normal searches. This board would be diminished without you. Thanks for all you do.

          1 Reply Last reply Reply Quote 2
          • C
            cipher-1024
            last edited by Jun 6, 2018, 4:21 PM

            @Claudia-Frank

            I swapped out the standard string search for the search_term with a regex one:

                    # search_term_position = line.lower().find(search_term)
                    # style_it(HIT_WORD, editor.positionFromLine(i)+search_term_position, len(search_term))
                    match = re.search(search_term, line, re.IGNORECASE)
                    if match is not None:
                        mlen = match.end() - match.start()
                        style_it(HIT_WORD, editor.positionFromLine(i)+match.start(), mlen)
            

            That may make it a little dirtier, but then the highlighting works for normal searches that don’t contain regex special characters as well as regex search results. I didn’t see any way for the python plugin to probe the UI to see what the last search type was so making it always assume a regex search works best for me.

            Thanks again Claudia.

            C 2 Replies Last reply Jun 6, 2018, 11:49 PM Reply Quote 1
            • C
              Claudia Frank @cipher-1024
              last edited by Jun 6, 2018, 11:49 PM

              @cipher-1024

              Hi,

              you are right - haven’t even thought about regex searches at all.
              Thank you very much for the improvements has been added
              to gist with slight modification to get even more close to npps output.

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 0
              • C
                Claudia Frank @cipher-1024
                last edited by Jun 6, 2018, 11:53 PM

                @cipher-1024

                By the way - I do have a strange phenomenon.
                If the cursor is on the end of a large buffer, then styling takes quite long whereas
                if the cursor is on the beginning of the document it styles it instantly.

                Not sure why this happens, assume scintilla internals (?) - needs investigation.

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 0
                • A
                  AZJIO AZJIO
                  last edited by Jun 14, 2018, 4:19 AM

                  Drawing on other people’s knowledge, I managed to make a plug-in for highlighting using regular expressions
                  http://purebasic.info/phpBB3ex/viewtopic.php?p=89420#p89420
                  http://rgho.st/8nRX9DYpj

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