Search++: A work in progress
-
In regards to:
Further testing suggests that Ctrl+Shift+0 does not work as a shortcut when assigned to any command. I haven’t yet checked to see if this is a known issue
Maybe see this:
https://community.notepad-plus-plus.org/post/90173
or some of the other postings about Ctrl+Shift+0 in that topic. -
@Alan-Kilborn said in Search++: A work in progress:
In regards to:
Further testing suggests that Ctrl+Shift+0 does not work as a shortcut when assigned to any command. I haven’t yet checked to see if this is a known issue
Maybe see this:
https://community.notepad-plus-plus.org/post/90173
or some of the other postings about Ctrl+Shift+0 in that topic.Thank you, Alan. Good that someone still has memory cells working. (@guy038 and I were both in that discussion, and it seems neither of us remembered.)
Similar to what it sounds like happened to Guy in that thread, I attempted to reset all shortcuts for keyboard languages to None even though they already were all None, except for the last one, which had Ctrl+Space associated with something to do with IME and Chinese (probably came about when I was testing Columns++ search in double byte character sets). I changed it to None (repeatedly), but it changed itself back as soon as I OK’d the change.
None-the-less, even though no visible setting has changed, now Ctrl+Shift+0 works. No rhyme or reason to this corner of Windows, it seems. :-(
-
Hi, @alan-kilborn, @coises and All,
Many thanks @alan-kilborn, for solving the
Ctrl + Shift + 0not working at all ;-)) I completely forgot this old post. Like @coises, I confirm that your memory cells are working perfectly !So, certainly, on my
Windows 10laptop, with your precious advice, I was able to solve this bug, inOctober 2023. But, it happens that I migrated my laptop toWindows 11, at the end ofOctober 2025. And I supposed that this migration reset a lot of parameters, whose this one !Thank you again for helping us find the right post !
Best Regards,
guy038
-
@guy038 said in Search++: A work in progress:
-Then use the Tools > Marked text → Selections option
=> The 4 lines are ALSO selected
Run a Ctrl + C action to put this selection in the clipboard Then, run a Ctrl + V action => The clipboard wrongly contains the string ABCDESo, despite of the Tools > Marked text → Selections action, nothing can be copied !?
I wrote:
After clicking on a button in a dialog, keyboard focus is on the button. (That’s standard Windows behavior, which I have not attempted to change in this case.) Your Ctrl+C went to the button. You needed to return focus to the document (e.g., Ctrl+N) before you could copy the selection.
That is true, but there is also a flaw in Marked text → Selections that causes an extra, empty selection to be included at the beginning, which could cause unexpected results when pasting.
A new version will be coming, but probably not until sometime tomorrow. Thank you for all your feedback.
-
@guy038 said in Search++: A work in progress:
- Choose the
Select > Select Before in Whole Documentor theSelect Beforeoption
=> No message and no matches ??
[…]
-Then use the
Tools > Marked text → Selectionsoption=> The
4lines are ALSO selected- Run a
Ctrl + Caction to put this selection in the clipboard
Version 0.5.1 fixes the Before/After bug and adds some new commands to the Tools button menu; Copy Marked Text should avoid the need to make a selection from marked text just to copy it.
There are a few other small changes that hopefully are improvements.
- Choose the
-
Hello @alan-kilborn, @Coises and All,
Yesterday, I was pretty sure the bug had been fixed. Unfortunately, today, perhaps because I needed to re-start my laptop for other reasons, the bug is still here !
-
Of course, I re-ran the @alan-kilborn’s solution but without success
-
I tried to delete then re-assign the
Ctrl + Shift + 0shortcut to thePrevious style of Find Mark stylecommand within N++ => Not better -
I turned my laptop off and then back on but no chance, either
-
I also visit the two sites, below, to get some tools to deternine which process could own the
Ctrl + Shift + 0shortcut => No result
https://www.nirsoft.net/utils/hot_keys_list.html
https://github.com/ITachiLab/hotkey-detective
Note that once
Hotkeydetective.exehas been launched with administator rights, it is said to press the stolen key in order that the software shows you a path to the guilty process. However, hitting theCtrl + Shift + 0shortcut does not show any line, personally !
Finally, I had the idea of simply changing the
Ctrl * Shift + 0shortcut toCtrl * Shift + 6. And… bingo, this change worked nicely !Thus, doing the same thing for the
Ctrl + 0shortcut seems a possible solution to this problem !BR
guy038
P.S. :
After using this work-around, I tried to assign the
Ctrl + Shift + 0shortcut to a command without shortcut, like theView > Summary...command. But it does not show theSummarizedialog :-((In contrast, the shortcut
Ctrl + 0, which is no longer used, displays the control character0, as I did not check theSettings > Preferences... > Editing2 > Prevent control character (C0 code) typing into documentoption. Thus no need of theControl Panelfeature in order to type theNULcharacter anymore ! -
-
Hello, @coises,
First, thanks for the
Select Before/Afterfix ! Now, the newCopy Marked Textoptions, with the separator choice, are really practical and straightforwardRegarding the
Tools > Select Marked Textoption ( formely Marked text → Selections ), we need to do aCtrl + Naction, to replace focus on current document first, before doing aCtrl + Caction
Regarding the
Enhance clearing behavior, I suppose that you mean :- If current document already contains some selections, based on a previous search
OR
- If current document already contains some marked text, based on a previous search
OR
- If current document already contains some invisible lines and some visible lines, based on a previous search
=> The appearance of current document does not changed if present search does not find any match ( => previous selections are kept, previous marks are kept and no other lines are hidden )
Of course, this makes sense !
This still one point that’s a bit unclear to me : what is the fundamental difference between all these options, when compared in pairs :
Find vs Find in Whole Document Find Backward vs Find Backward in Whole Document Count vs Count in Whole Document Count Before vs Count Before in Whole Document Count After vs Count After in Whole Document Find All Before vs Find All Before in Whole Document Find All After vs Find All After in Whole Document Select Before vs Select Before in Whole Document Select After vs Select After in Whole Document Mark Before vs Mark Before in Whole Document Mark After vs Mark After in Whole Document Show Before vs Show Before in Whole Document Show After vs Show After in Whole Document Replace and Find vs Replace And Find in Whole Document Replace and Find Backward vs Replace and Find Backward in Whole Document Find or Replace vs Find or Replace in Whole Document Find Backward or Replace vs Find Backward or Replace in Whole Document Replace All vs Replace All in Whole Document Replace All Before vs Replace All Before in Whole Document Replace All Aftrt vs Replace All After in Whole DocumentBest Regards,
guy038
-
@guy038 said in Search++: A work in progress:
This still one point that’s a bit unclear to me : what is the fundamental difference between all these options, when compared in pairs :
The principle (see the last bullet point under help for search scopes) is that commands which don’t specify a scope search in marked text if there is any; otherwise, in the current selection if it is not empty; otherwise, in the whole document. That’s subject to the Settings: if you unchecked both Automatically search within selections and Automatically search within marked text, then all the pairs of commands you listed would be identical; and there are the limits on when selections are considered “large enough” to trigger search within selection. (A selection that is the immediate result of a stepwise search never causes the same search to search within that selection no matter how large it is.)
There are two special cases, and a third questionable feature, also involved:
-
There are no Before or After commands with in Selection scope. (My logic is that something can’t be both in the selection and before or after it.) So search commands that include Before or After can only be in Marked Text or in Whole Document.
-
Mark commands that don’t specify a scope don’t automatically scope to in Marked Text even if Automatically search within marked text is enabled. What happens is that unless you’ve checked Always unmark all text before Mark command, default Mark commands add to existing marks. I know this is a different behavior from selections, but I think because selections are so volatile, and marks are not, it is natural to use them in different ways. Should this exception be an option in Settings? I’m inclined to add it as a default-checked sub-option of Automatically search within marked text.
-
Search commands that specify in Selection or in Marked Text search the whole document if there is no (non-empty) selection or marked text. I’m questioning the sense of that now. I’m thinking that if the user specifies “in selection” or ”in marked text,” and there is none, the search should fail with a message like “No marked text to search” rather than silently discarding the specified scope.
Thoughts about that logic, especially point 3 (which I am inclined to change in the next release) are welcome and encouraged.
I have tried to keep as much “symmetry” as I could, to make it all more comprehensible. I think it is possible that I have created some nonsense in practice.
Points 1 and 3 together mean that Before and After commands without a scope are either the same as Before/After in Marked Text if Automatically search within marked text is checked, or the same as Before/After in Whole Document if it isn’t. However, as I wrote, I’m questioning point 3; without that, when the relevant setting is checked, there would be a difference (the commands that don’t specify a scope would switch between in Marked Text and in Whole Document depending on whether there was any marked text in the document, whereas neither command that specified one scope would switch to the other).
So… looking at the full list you gave, group by group, assuming default settings… this is what is supposed to happen (full testing of every possible case has not been done):
Find vs Find in Whole Document Find Backward vs Find Backward in Whole DocumentThe two on the left will find the next match in marked text following or preceding the current position or selection if any text is marked; otherwise they will find the first or last match in the selected text if “enough” text is selected; otherwise they will find the next match following or preceding the current position or selection in the whole document. Those on the right will always find the next match following or preceding the current position or selection in the whole document regardless of whether any text is marked or selected.
Count vs Count in Whole DocumentCount will count only matches in marked text if any text is marked; otherwise it will count only matches in selected text if “enough” text is selected; otherwise it will count all matches in the whole document. Count in Whole Document will always count all matches in the whole document regardless of whether any text is marked or selected.
Count Before vs Count Before in Whole Document Count After vs Count After in Whole DocumentThe two on the left will count only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will count matches before or after the current position or selection in the whole document. Those on the right will always count matches before or after the current position or selection in the whole document regardless of whether any text is marked.
Find All Before vs Find All Before in Whole Document Find All After vs Find All After in Whole DocumentThe two on the left will list only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will list all matches before or after the current position or selection in the whole document. Those on the right will always list all matches before or after the current position or selection in the whole document regardless of whether any text is marked.
Select Before vs Select Before in Whole Document Select After vs Select After in Whole DocumentThe two on the left will select only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will select all matches before or after the current position or selection in the whole document. Those on the right will always select all matches before or after the current position or selection in the whole document regardless of whether any text is marked.
Mark Before vs Mark Before in Whole Document Mark After vs Mark After in Whole DocumentI’ll double-check my logic later, but I think these are identical, since (1 above) Before/After can’t be in selection, and (2 above) Mark doesn’t automatically scope to marked text. It’s unclear to me which ones to remove, since either choice breaks the symmetry and could be confusing to users, but having two commands that do the same thing is also confusing.
Show Before vs Show Before in Whole Document Show After vs Show After in Whole DocumentI grant that this would be a strange use of Show. In the circumstance where there are hidden lines both before and after the current position or selection, and there is some marked text in document, the ones on the left would search only marked text before or after the current position or selection for lines to unhide, while the ones on the right would search all text.
Replace and Find vs Replace And Find in Whole Document Replace and Find Backward vs Replace and Find Backward in Whole Document Find or Replace vs Find or Replace in Whole Document Find Backward or Replace vs Find Backward or Replace in Whole Document Replace All vs Replace All in Whole Document Replace All Before vs Replace All Before in Whole Document Replace All After vs Replace All After in Whole DocumentThese are like their Find and Find All counterparts. The ones on the left work like “in Marked Text” if any text is marked; otherwise, like “in Selection” if “enough” text is selected; otherwise like “in Whole Document” (like the ones on the right).
-
-
@guy038 said in Search++: A work in progress:
This still one point that’s a bit unclear to me : what is the fundamental difference between all these options, when compared in pairs :
[…]
Count Before vs Count Before in Whole Document Count After vs Count After in Whole Document Find All Before vs Find All Before in Whole Document Find All After vs Find All After in Whole Document Select Before vs Select Before in Whole Document Select After vs Select After in Whole Document Mark Before vs Mark Before in Whole Document Mark After vs Mark After in Whole Document Show Before vs Show Before in Whole Document Show After vs Show After in Whole Document[…]
Replace All Before vs Replace All Before in Whole Document Replace All Aftrt vs Replace All After in Whole DocumentNow that I think about it some more, it seems like I could simplify this by removing all the Before and After search commands that don’t include a scope (in Selection, in Marked Text or in Whole Document). I don’t think anyone is going to want to make a before or after command the one-click action for a button; and otherwise, once you have to select from a menu anyway, why not select what you mean instead of selecting something that’s going to infer what you want?
Thanks again, Guy, for looking at this so carefully and pointing out the confusing and redundant parts.
If no one thinks it’s a bad idea, I’ll probably remove the unscoped Before and After searches in the next release.
-
Hi, @coises and All,
@coises, I read carefully your last two posts and many thanks for all your explanations !
Regarding your point
#3:You said :
I’m questioning the sense of that now. I’m thinking that if the user specifies “in selection” or ”in marked text,” and there is none, the search should fail with a message like “No marked text to search”
Indeed, it quite disturbing for example that, when no selection and no marked text exists, the
Count in selectionorCount in Marked Textoptions still return all the matches of current document ! Give it a try, searching for the insensitive wordfixwithin the lastchange.logfile ( You should get32matches ! )So I support your idea that, in this specific case, the search should fail with the message
No marked text to searchorNo selection to search- Regarding your point
#1:
I totally understand your logic. This make sense !
- Regarding your point
#2
You began with :
Mark commands that don’t specify a scope …
Are we agree that you’re speaking about the
Mark BeforeandMark afteroptions ONLY ? Presently, as you said, these two commands, not restricted to a scope, search throughout all file contents.Now, as expressed in your very last post, I do support your idea to avoid any command, containing Before or After, that do not include a scope (
in Selection,in marked Textandin Whole Document). Thus, that should solve automatically this problem ;-))
One question :
-
Let’s suppose the
v8.9.3change.log in a tab -
Now, enter the regex
(?si) 1.+?(?=^\R)in the Search dialog -
Click on the ▼, after the defeautl
Find Alloption -
Run the
Mark > Mark in Whole Documentoption
=> Message :
Marked 4 matches-
Now, with the
(?si) 1.+?(?=^\R)regex still present in the Find dialog -
Run the
Mark > Mark in Marked Textoption
=> We get the message
No matches found in marked text. Is this coherent, @coises ?. To my mind, I was expecting the message4 matches in marked text!Of course, I know that, normally, I should have changed the search, in between ! For example :
-
Write the
(?i)fixregex, in the Find dialog -
Run again the
Mark > Mark in Marked Textoption
=> The
fixword, whatever its case, is now marked, from all the previous marked regions, ONLY !You’ll note that the
fixstring within all the lines beginning withNotepad++, which were not concerned by the previous search, are not marked, as expected !
- Regarding the
Remove marks from all open documentsandRemove marks from documents in this viewoptions, in theToolsdialog :
Could you move them to an other place of the
Toolsdialog, in order to not be close to theRemove marks from active documentoption, that we’ll probably use more often ?OR :
Could you add a confirmation dialog for these two specific options ?
Best regards
guy038
- Regarding your point
-
@guy038 said in Search++: A work in progress:
- Regarding your point
#2
You began with :
Mark commands that don’t specify a scope …
Are we agree that you’re speaking about the
Mark BeforeandMark afteroptions ONLY ? Presently, as you said, these two commands, not restricted to a scope, search throughout all file contents.It applies to the plain Mark command, too. If there is a non-empty selection (that’s “large enough” per Settings), Mark will perform Mark in Selection (not possible for Mark Before and Mark After). But none of the three will perform Mark […] in Marked Text; that has to be selected explicitly. The same isn’t true for Select; if there is an existing selection (large enough), Select will perform Select in selection. What I was thinking is that perhaps this difference between Mark and Select should be “explained” by having an additional setting for each action, enabled only when Automatically search within {selections | marked text} is checked, that controls whether the matching command is an exception (that is, Select doesn’t perform Selection in Selection, or Mark doesn’t perform Mark in Marked Text). The current behavior would have the “except Select” box unchecked and the “except Mark” box checked.
It comes down to: What do you want to do when you say Select and there’s already a selection, or you say Mark and there’s already marked text? Do you replace the existing selection or marks? add to them? or search within them?
And when I put it that way… I have to think this through some more. From a user’s perspective, the Settings I have are too difficult to figure out. I’m having trouble getting a clear picture of what settings make sense with what other settings and I wrote the damn thing. :-(
Now, as expressed in your very last post, I do support your idea to avoid any command, containing Before or After, that do not include a scope (
in Selection,in marked Textandin Whole Document). Thus, that should solve automatically this problem ;-))It would get rid of some of the problem, but not all of it. Where I’m stuck is that I really want there to be “adaptive” commands (the plain Count, Find All, etc.) that recognize when the user would want to search in a selection or in marked text, so they can be the one-click action on a button. Alas, there’s that fundamental design flaw in all computers thus far produced: the RUM (“read user’s mind”) instruction was never implemented. It could be that making an appropriate guess is hopeless. But I really don’t want an oversized, cluttered interface with a matrix of 20 buttons, and I really don’t want users to have to select operations they use often or repeatedly from button menus. So, at least for a while, I’m going to keep trying.
I appreciate your feedback on these issues very much. Anything you, or anyone, can tell me about what works smoothly and what is difficult to use or doesn’t work as expected is helpful.
-
Now, enter the regex
(?si) 1.+?(?=^\R)in the Search dialog -
Click on the ▼, after the defeautl
Find Alloption -
Run the
Mark > Mark in Whole Documentoption
=> Message :
Marked 4 matches-
Now, with the
(?si) 1.+?(?=^\R)regex still present in the Find dialog -
Run the
Mark > Mark in Marked Textoption
=> We get the message
No matches found in marked text. Is this coherent, @coises ?. To my mind, I was expecting the message4 matches in marked text!I did document this, but it’s easily missed:
For a regular expression search, each run of marked text is searched independently; the search in any span of marked text cannot “see” outside that span. This affects the behavior of assertions (including word boundaries, lookaheads and lookbehinds, ^ and $).
The search in Columns++ has the same limitation. I couldn’t figure out a practical way to make it work other than this way.
Regarding the
Remove marks from all open documentsandRemove marks from documents in this viewoptions, in theToolsdialog :Could you move them to an other place of the
Toolsdialog, in order to not be close to theRemove marks from active documentoption, that we’ll probably use more often ?OR :
Could you add a confirmation dialog for these two specific options ?
I will work out something so they won’t be easily clicked by accident.
- Regarding your point