Save Search Results with Highlighting
-
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.
-
Import a new syntax with highlighting
https://pastebin.com/ZeWQRpprI can give a black theme
-
-
@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. -
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.
-
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 -
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 -
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