Search in selected text doesn't work



  • I may easily have overlooked something, so any comments will be highly welcome!
    If I select text with SHIFT-DOWN or if I use the EDIT > BEGIN/END SELECT, then launching the Find dialogue to find strings in the selection with ‘IN SELECTION’ enabled, that simply won’t work. And chosing the Wrap Around doesn’t change anything. The result will be that the next string downwards and outside of the selection will be found.

    This has very negative effects on the usage of Macros, because a selective search is the only thing you can do in a Macro to avoid serious errors when instructing a search, because the macro will simply continue its instructions wrongly if the search yields nothing,
    To avoid this I would have to make a script to run conditional instructions which I don’t want.

    As a consequence of the search not working as intended, most simple macros I want to do become simply unfeasable without scripts. Not everyone should have scripting knowledge.

    In the case I haven’t overseen something, PLEASE MAKE THE ‘IN SELECTION’ WORK REASONABLY!

    Any comments welcome,
    Greetings,



  • @MikeTrans

    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”:

    803ef859-3ca1-40ec-8546-fe66eb4be2ad-image.png

    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.



  • @MikeTrans ,

    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.


Log in to reply