Search in selected text doesn't work
-
There is no “Find Next” for selected text. Your option for selected text searching are “Find All in Current Document” with “In selection” ticked.
If you’ll notice, the “groupbox” element that has the “In selection” checkbox in it wraps the “Count” and “Find All in Current Document” buttons. This is meant to indicate that “In selection” only applies to those actions.
-
@Alan-Kilborn , thanks for your feedback. Sorry to contradict you but: What I get in the CTRL-F when selecting more lines in a text is:
- Find next
- Count
- Find All in current Document (I don’t want to do that)
- Close
So what?
-
How do you search for words in a selected text please?
-
@MikeTrans said in Search in selected text doesn't work:
Sorry to contradict you but:
Look in the FIND dialog. Look for a grey box around the “In Selection” checkbox and the two buttons “Count” and “Find All in Current Document”:
As Alan tried to explain, this grey box is trying to tell you that the “In Selection” option only applies to “Count” and “Find All in Current Document”. “In Selection” checkbox does not apply to the “Find Next” button. It is working as designed.
(If you think about the functionality, “Find Next” changes the selection. So if “In Selection” were to apply to that button as well, then the first time you clicked “Find Next”, the selection would only be the found text; so from then on, “Find Next” could only find the same text that the selection moved to, so it would never find any others. That is the reason that “In Selection” was intentionally and purposefully designed to not work with “Find Next”.)
-
OK, I now understand that there is a square around the box which points to the 2 options. But How do I restrict a search to selected text then?
-
I can use the ‘Mark’ option instead of the Find, this will mark me within the selected text, alas it’s useless for me because it won’t move the cursor there, so what I said at the start still applies: any macro with a search instruction becomes useless only because there is no option for a search with selected text. It should be included.
-
The macro feature was meant for simple linear sequences. If you want if/then/else functionality, you need to use a plugin – either a custom made one (overkill, IMO) or one of the scripting plugins like PythonScript, which allows you to use the full power or a Python interpreter to write a script to control Notepad++, including searching.
-
@PeterJones , Yes that’s true and also what I said in my initial post. But I’m not going to spend weeks to learn the PythonScript which I have installed as a plugin just to see what it can do, it certainly can do what I’d like, but after weeks of learning only… And it’s also too bad that the NP cannot move to bookmarks in a macro, that would also help a lot.
-
@MikeTrans said in Search in selected text doesn't work:
But How do I restrict a search to selected text then?
As stated earlier, you can’t restrict a “Find Next” type search to selected text.
-
Actually in my case I found a solution instead of searching for selected text. In the Mark option you can bookmark the line and in a macro you can use the F2 to jump to selected text, make instructions and then use the CTRL-F2 to delete the bookmark. Doing that way a certain type of conditional instructions can be performed without having to use scripts.
Thank you all,
bye.