Search++: A work in progress
-
Search++ version 0.6.1 is available.
This update enhances the Search++ Results list, including adding more detail to the search headers, implementing an “automatically purge” toggle and recognizing single-click in the margin.
All comments, critiques and thoughts are welcome!
- Would it be possible to add a Purge option, like in the context menu of the N++
Search resultsdialog ?
- Although written in your files list, I also noted that the number of scanned files is not reported in the
Search++ Results** dialog, unlike with the N++ **Search results` dialog
[…]
And, if possible, it would be best to include the chosen options of the current regex too, like
Regex, Case,...?!To end with, I noticed that, within the N++
Search results, it is possible to easily see all files which has matches, without seeing the matched linesThis update addresses all those points. See the help for details about the commands in the results list.
I’m not handling folding quite the same way as Notepad++ does. (It could be that in time I will decide to try to emulate Notepad++’s appearance and behavior more closely.) What I did was add a context menu option (also available as Shift+Enter or Shift+double-click) for search header lines that toggles the fold state of all documents in that search without folding the search itself. So if you select Expand/Collapse Search, or double-click, the search folds or unfolds with the folding of documents within it unchanged. If you select Expand/Collapse Documents, or Shift+double-click, when the search is expanded, all documents within that search either expand or collapse (the opposite of whatever is the state of the first document).
I added a few other things, like clicking in a margin being equivalent to double-clicking in a header line or on the first position in a detail line. There is a purge toggle now, and search header lines include information about how many files were searched and the type of search (including modifiers).
- Would it be possible to add a Purge option, like in the context menu of the N++
-
Hello, @coises and All,
Thanks for this quick new version. And many thanks for implementing all propositions that I suggested ;-)) So far, everything seems to work nicely !
Now, one request :
- Would it be possible, in the
Search++ Resultsto prevent the displaying of the last character ( an?sign inside a rectangle ) in all lines ( Search line, Document lines and Matched lines ) ? Personally, I think it globally makes the display harder to read ! Just a personnal appreciation
And one question :
Natively, you can swap the keyboard focus between the N++
Search resultsand theCurrent documentwindow by hitting theF7key. I do not see an equivalent with your Search++ pluginI mean :
When, both, the
Search++and theSearch++ Resultspanels are opened, you can swap the keyboard focus between them with theCtrl + Hshortcut. How to toogle between theSearch++ Resultsand theCurrent documentwindow ?Best Regards,
guy038
- Would it be possible, in the
-
Hi, @coises and All,
Sorry, but I came across a serious bug regarding the
ICUsearch, sinceSearch++versionv0.6-
The Find in Selection, Find in Marked Text and Find in Whole Document options
-
The Find All in Selection, Find All in Marked Text and Find All in Whole Document options
Triggers the closure of Notepad++, without saving any configuration file and unsaved tabs
After some quick tests :
-
The Select, Mark and Show options,
-
The Count in Selection, Count in Marked Text and Count in Whole Document
Seems to work correctly in
ICUmodeBR
guy038
-
-
@guy038 said:
I came across a serious bug regarding theICUsearch, sinceSearch++versionv0.6Thank you for the detailed report. I can reproduce it… in the release version. It doesn’t happen in a debug version (which uses exactly the same code); so it’s a subtle error somewhere. I will find it.
I changed some existing code when I added Find in Files. You observation that this fault began in 0.6 will help me know where to look.
-
- Would it be possible, in the
Search++ Resultsto prevent the displaying of the last character ( an?sign inside a rectangle ) in all lines ( Search line, Document lines and Matched lines ) ?
Huh. I know what must be causing that, but I don’t know why it is causing it (on your system, but not on mine). (I set line ending characters to be displayed, but then to display with zero opacity. I do this so the marks I place to indicate a zero-length match will still show when the match occurs at the end of a line. The mark must be placed on the following character, and if the character isn’t shown, neither is the mark.)
Would you tell me what font you use for Notepad++ documents (the Search++ Results window copies that from the document window) and what you have at Settings | Preferences… | MISC. for rendering mode (GDI or DirectWrite)?
If I can figure out why you see the characters, hopefully I can figure out what to change so that you (and others with the same configuration) won’t see them.
Natively, you can swap the keyboard focus between the N++
Search resultsand theCurrent documentwindow by hitting theF7key. I do not see an equivalent with your Search++ pluginThe problem is that Search++ can’t (or shouldn’t… see below) control what shortcut keys do when focus is in Notepad++.
From the Search++ Results window, Ctrl+N will take you to the document. To switch from the document to the Results, though, I’d have to add a Search++ Results entry on the Plugins | Search++ menu, and then you’d have to set a shortcut for that in the Notepad++ shortcut mapper. You probably wouldn’t want to give up Ctrl+N, though.
The only way to get from Notepad++ to Search++ (or any plugin) is through a shortcut that’s either manually added in Shortcut Mapper or added by default in the plugin’s setup. (I’m still not sure how conflicts are resolved when a plugin defines a shortcut key that is already defined by default, by the user or by another plugin. I did define a few shortcut keys in Columns++ for manipulating rectangular selections, but it still bothers me that it feels a little… arrogant… to do that. My plugin might not be as important to the user as something else that also wants those keys.)
I am open to suggestions on how to manage this. I agree that consistency between navigation keys used when focus is in the plugin and when focus is in Notepad++ would be desirable, I just don’t have a plausible design for it.
- Would it be possible, in the
-
Hi, @coises,
Practically, I installed your plugin
Search++on a8.9_x64version of N++As you can see, in the screenshot below :

-
I did not hit the Show All characters option (
¶) -
I did a search on a specific folder (
^Music) -
Most of the time, I use the Consolas font (
Consolas / Version 7.00 / Disposition **Open Type** signé numériquement **True Type Contours)
But you found out the culprit : it’s just because the
GDI ( most compatible)option was selected !. Luckily, for any other option of the rendering mode, after closing an re-starting N++, this special character does not display, anymore !
Regarding the problem about swapping between the
Search++ Resultsand theCurrent Documentwindow, do not bother about it :-))May be, you remenber that I personally used the
Ctrl + Shift+ Nshortcut to open theSearch...option. Thus, each use of theCtrl + Shift + N, alternatively, opens or closes mySearch...docked panelSo, I was able to deduce a way ( rather long, of course ) to do that :
-
Firstly, use
Ctrl + Nshortcut to switch to theCurrent Documentwindow -
Secondly, use the
Ctrl + Shift + Nshortcut to put the focus on theSearch..panel -
Thirdly, use the
Ctrl + Hshortcut to get the focus on theSearch++ Resultspanel, again !
Even, on my French keyboard, the
Hkey is quite close to theNkey !BR
guy038
-
-
But you found out the culprit : it’s just because the GDI ( most compatible) option was selected !. Luckily, for any other option of the rendering mode, after closing an re-starting N++, this special character does not display, anymore !
Thanks for documenting that!
It should appear correctly in GDI mode too, of course. I suspect the problem will turn out to be that GDI mode doesn’t support alpha transparency, so my setting the opacity to zero is doing nothing. I’ll have to find another way.
-
Search++ version 0.6.2 is available:
- Fix a critical error that caused ICU searches to crash Notepad++.
- Fix unwanted characters appearing at the ends of lines in the Results list with Notepad++ rendering mode GDI.
- Fix regression of line ending symbols being in text color instead of white space color, and switch the CRLF symbol in GDI mode to one that hopefully renders more consistently.
Thanks to @guy038 for catching the ICU error and the unwanted characters in the results list in GDI mode.
(The ICU error appears to have been due to an uninitialized variable. The faulty code has been there from the beginning. As chance would have it, up until now it just happened to land on memory that contained an innocuous value. Hopefully I didn’t miss anything else similar…)
-
Hello, @coises and All,
Again, thanks for quickly fixing the different issues ( and some others, at the same time ! ). So far, everything looks OK ;-))
Now, I did a test, searching in all files of my
D:USB key, with :-
The native N++
Find in Filesdialog -
The Search++
Search in Filesdialog -
The MultiReplace
Find All in Filescommand
To be sure to process fair tests, I unplung my USB key, re-start my laptop completely, replug my USB key and starts a new N++ session, before running these three
Find in Filesoperations, in turn !I searched for the
Fistring, with theMatch caseand theRegular expressionoptions checked. I got :-
27,112 matches in 833 files of 1,761 searchedfor theN++Search Results panel, in1m 37s -
27,112 matches in 833 files of 1,761 filesfor theSearch++Search++ Results, in2m 21s -
27,087 hits in 835 file(s)for theMultiReplaceSearch results panel, in1m 36s
However, when you re-run this same search, without exiting N++, right after the first search, we get the job done in about :
-
6sfor theN++search -
5.2sfor theMultiReplacesearch -
1,1sfor theSearch++search
So, apparently, the results of the first search seem to speed up all the next same searches, whatever the search engine used ( native one or plugins ones ) !
Best Regards,
guy038
P.S. :
I understood the small differences which occur in the
MultiReplacesearch( 27,112 - 25 )matches in( 833 + 2 )files. But, I prefer, first, to study more closely theMultiReplaceplugin, which is very powerful too and reply later to @thomas-knoefel. It concerns the encoding of4files which is not recognized properly and which occurs only when theFind in Filescommand is used. TheFind AllandFind in Docscommands, themselves, give correct results for these4files !? -
-
So, apparently, the results of the first search seem to speed up all the next same searches, whatever the search engine used ( native one or plugins ones ) !
My guess is that the total size of all the files on your USB key was well less than the amount of memory available to Windows. If so, then (I think) that when you repeated a test, almost nothing was read from the USB key: Windows already had the whole drive cached in memory.
It makes sense that in that circumstance, Search++ would be several times faster, because it uses multiple threads for search in files; I’m pretty sure both native Notepad++ search and MultiReplace are strictly single-threaded. So when the actual searching, rather than reading the files, is what takes most of the time, Search++ is using all cores of your CPU and the others are using just one.
I do wonder, though, why Search++ is so much slower on the first execution. I suspect that something in the way I’m reading files (trying to get several at once, since multiple threads are running) is reducing throughput from the USB key. There is probably a way to make that better. Whether I can figure out what it is remains to be seen.
Thanks for your testing!
-
I understood the small differences which occur in the MultiReplace search ( 27,112 - 25 ) matches in ( 833 + 2 ) files. But, I prefer, first, to study more closely the MultiReplace plugin, which is very powerful too and reply later to @thomas-knoefel. It concerns the encoding of 4 files which is not recognized properly and which occurs only when the Find in Files command is used. The Find All and Find in Docs commands, themselves, give correct results for these 4 files !?
As best I can make out, like Search++, MultiReplace processes searches against documents open in Notepad++ using the copy of the document that Notepad++ has loaded into Scintilla. (I can’t really think of another way it could be done.) That means that for existing files, Notepad++ has already determined the encoding and either loaded it as ANSI or UTF-8, or translated it to UTF-8. (Notepad++ never sets Scintilla to use any encoding other than UTF-8 or the system default code page; anything else is translated to UTF-8 and translated back on writing.)
So it’s no surprise that we’re both using the same encoding as Notepad++ for Find All and Find in Open Documents, because we’re just using the work Notepad++ has already done.
I think MultiReplace uses an invisible Scintilla to process searches in files. It could be that it hasn’t entirely replicated the labyrinthine logic Notepad++ uses to determine the encoding of a file (including the effect of Preferences | MISC. | Autodetect character encoding).
Search++ does not duplicate that logic either, but it approaches the problem in a different way. Rather than using an invisible Scintilla control, Search++ uses its customized version of Boost::regex directly on the data in the file buffer. So I never translate the file encoding to anything else. I do have to determine the encoding, though, as the choice of iterator for Boost::regex depends on that.
There are limitations, not yet formally documented, to the way Search++ handles encodings for Search in Files:
- UTF-16 files without a byte order mark are not recognized as such. (They’ll be misread as something else.)
- UTF-8 files without a byte order mark that contain any invalid UTF-8 sequences will be processed using the system default (ANSI) code page.
- Pure ASCII files are processed as UTF-8. (This doesn’t matter for Find, but I will have to review it when I implement Replace, since someone might include non-ASCII characters in the replacement text. I think there will have to be a user control to determine whether to promote ASCII to ANSI or to UTF-8.)
- Files without a byte order mark that are not pure ASCII and contain any invalid UTF-8 characters are processed using the system default code page. No attempt is made to detect whether a different legacy code page is more likely to be correct, or is explicitly declared within the file.
The sad fact about file encoding is that in most cases there is no algorithmic way to be absolutely certain about what it is. (The exceptions are pure ASCII — but then, if any non-ASCII characters are introduced, there is no way to know how those should be encoded — and some file types, like HTML and XML, that can include a declaration of their own encoding, the declaration itself being in plain ASCII. Byte order marks are, in practice, another exception: they could occur in a legacy encoding, but they would be so uncommon at the start of a file that it’s safe to assume they are definitive, or the file has been purposely engineered to cause mis-detection.)
I will probably improve handling of file encodings as Search++ evolves. I doubt that I will attempt to duplicate exactly what Notepad++ does.
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