How find in selection by key alt? Hello.
-
Without alt find in selection working, per what thank.
-
It is unclear what you are asking.
But, maybe you are asking if it is possible to find in a rectangular block selection?
If so, then no it is not currently possible to do that.
-
What problem not possibility? If this possibility will appear, then how soon? -
@qwe said in How find in selection by key alt? Hello.:
What problem not possibility? If this possibility will appear, then how soon?
That option will light up when you have a number of characters pre-selected in the tab you are working on. See the online manual reference here.
Terry
-
As an example of pre-selection we have:
- no selection of text and the option is “dimmed” as you saw.
- pre-selection of text and the option is “available”.
Additionally, if you pre-select more than 1024 characters the option will also be ticked, see the online manual a page down from my previous manual link.
Terry
-
@qwe said in How find in selection by key alt? Hello.:
What problem not possibility? If this possibility will appear, then how soon?
As @Alan-Kilborn said, if you have a block selection (the rectangle made while selecting with Alt key depressed), then that option is not available.
selection type screenshot details normal Can do “in selection” rectangle (alt) Cannot do “in selection” What problem not possibility?
The search-and-replace engine assumes a continuous block of text for its algorithms to work. When you do a column-mode / rectangle / Alt+ selection, interally, it includes multiple equal-width non-continuous blocks of text, and the regex engine cannot handle that. Notepad++ uses an industry-standard search-and-replace library (Boost’s regex engine), and the Notepad++ authors will not be writing their own engine just to handle the rectangular-selection outlier condition.
workaround / solution
If you really need to search+replace in just the contents of a rectangular block, I suggest a multistep solution
- In your original file, do your rectangular selection
- Copy that text
- Create a temporary file
- Paste into that file
- Do your search/replace: make sure that you don’t change the size of the rectangle in that replacement
=> - Column-Select the rectangle from the temporary file and copy
- Return to the original. If you clicked on the tab titles rather than in the tab editor, the original rectangle selection will still exist
- Paste overtop the rectangle:
-
@PeterJones said in How find in selection by key alt? Hello.:
Notepad++ uses an industry-standard search-and-replace library (Boost’s regex engine), and the Notepad++ authors will not be writing their own engine just to handle the rectangular-selection outlier condition.
There’s nothing that I saw in the OP’s question about regular expressions.
That being said, even if it were regex related, there’s nothing stopping Notepad++ authors from allowing search/replace to act on a rectangular block – only an unwillingness to thus far write that code (of course lack of time could be a factor as well).If we are talking about replacement, and not simply find, then I have a scripted solution for “replace all in selections” which will work for a rectangular block. Unfortunately the script doesn’t work for searching, because there is no easy scripting interface to the Search results window.
-
@Alan-Kilborn said in How find in selection by key alt? Hello.:
If we are talking about replacement, and not simply find, then I have a scripted solution for “replace all in selections” which will work for a rectangular block.
I neglected to provide the link to the script in case there is interest. HERE it is.
-
You are correct, there wasn’t anything specific to regex there, and I convoluted search/replace and regex in my mind when invoking the mention of the boost library.
If it were to be implemented so that each “row” of the search/replace were done separately, then it wouldn’t be difficult to implement, and it wouldn’t matter if it were normal, extended, or regex search. But trying to search across multiple rows in the rectangle would present a lot of technical challenges – I can think of a few immediately, and I’m sure implementing it would find a lot more. (And whatever decisions are made on those challenges would provoke some vocal percentage of the users of that feature to complain that it was the wrong implementation, and they would all be right but annoying.)
But I had forgotten about your scripting solution, so thanks for bringing that up.
-
@PeterJones said in How find in selection by key alt? Hello.:
But trying to search across multiple rows in the rectangle
I would think that anything the developers implemented for rectangular selection searching/replacing could have the caveat that each row (the selected part) is independent and you can’t search across rows with it.
And that’s what my replace-all script assumes as well.
IMO, that kind of thing (the possibility to search/replace across rows defined by the rectangular selection), is NOT what has prevented the developers from adding the feature to date.