bug? find_in_selection
-
When updating to 7.8.2, I did notice the line “8. Enhance “In Selection” option in Find dialog.” in the change.log
When selecting the first 13 lines of the change.log, and than a find for “er”, with option ‘in-selection’ checked. It finds a piece of text ‘outside’ the selection.
See this animated GIF: https://imgur.com/LzUinlD
P.S. Why can an animated GIF not be uploaded here?
-
@Luuk-v said in bug? find_in_selection:
I did notice the line “8. Enhance “In Selection” option in Find dialog.” in the change.log
What you are describing isn’t what that
change.log
entry is referring to. Sadly, there is still no way to Find something in selected text only. -
@Luuk-v said in bug? find_in_selection:
P.S. Why can an animated GIF not be uploaded here?
Use this syntax:
![](https://i.imgur.com/LzUinlD.gif)
-
BTW, if you’ll notice, in the Find tab of the Find window, the In Selection checkbox appears wrapped in a groupbox along with the Count button. This implies (strongly) that ticking the In Selection checkbox will ONLY matter when the Count button is pressed, NOT when, say, the Find Next button is pressed.
-
Hello, @luuk-v, @alan-kilborn and All,
Alan is right about it. The point
8
enhancement, from @Scott-Sumner, prevents people for enabling theIn selection
option in case of multiple selections. In other words, you can tick theIn selection
option ONLY IF the main selection is active and not when column selection or multiple selections are active. Refer to :https://github.com/notepad-plus-plus/notepad-plus-plus/issues/7532
Two work-arounds are possible :
-
The trivial one : copy your selection in a new tab and do a classical search !
-
Insert two different lines, standing for the beginning and the end of your selection and use an appropriate regular expression to limit the search between these two boundaries
The generic regex search to use is :
SEARCH
(?s)
Expression(?=((?!
Start Line).)*
End line)
So, assuming, for instance, the
change.log
file of Notepad++v7.8.2
and :-
The simple line of five 0’s (
00000
) as the starting boundary, inserted between points3
and4
-
The simple line of five 1’s (
11111
) as the ending boundary, inserted after last point11
giving the text :
Notepad++ v7.8.2 enhancements and bug-fixes: 1. Add key shortcuts in Save or not dialog. 2. Add find in files filter excluding ability. 3. Add "Open UDL folder" command. 00000er 4. Fix issue of showing save dialog twice while cloned file is dirty. 5. Enhance "Open Explorer" command in Folder as workspace with expected path. 6. Fix tab dragging issues. 7. Enhance "Close all but This" and "Close all to the left/right" commands while files are dirty. 8. Enhance "In Selection" option in Find dialog. 9. Fix Notepad++ blocked in notification zone issue. 10. Make end-of-line conversion operations macroable. 11. Fix "View Current File In" commands disabled problem in some situations.er er11111 Included plugins: 1. NppExport v0.2.9 2. Converter 4.2.1 3. Mime Tool 2.5 Updater (Installer only): * WinGup (for Notepad++) v5.1.1
-
Open the Find dialog (
Ctrl + F
) -
According to your search and the
change.log
text, use the regex(?s)er(?=((?!00000).)*11111)
-
Tick the
Wrap around
option -
Select the
Regular expression
search mode -
Click on the
Find
button OR hit theESC
key to close theFind
dialog and go on searching, hitting theF3
key
Remarks :
-
It’s worth to point out that the Start and End boundaries must be different and must not exist in current text !
-
Of course, you may use any character, instead of digits :
!!! ..... %%%
,#### ..... ----
,START ...... END
, … -
You may use several zones
Start Line ......... End Line
, in your text. So, only the occurrences of Expression, within the different zones created, will be found ;-)) -
If you hit the
Shift+ F3
shortcut, it always selects the last occurence of the previous zone scanned
A variant of this method would be to scan for the occurrences of Expression, from current location of caret till an Ending boundary. In that case, the generic regex can be shortened to :
SEARCH
(?s)
Expression(?=.*
End Line)
Giving, in your example, the regex
(?s)er(?=.*11111)
Of course, this alternate regular expression syntax only makes sense if there is only one ending boudary
11111
Best Regards
guy038
-
-
@guy038 said in bug? find_in_selection:
Alan is right about it. The point 8 enhancement,
It is good to be right. But…I suppose I should have supplied the information that @guy038 did to fill in the blanks about “point 8” in the change log.
It appears that 3 or perhaps more enhancements were made in Notepad++ 7.8.2 regarding the “in selection” checkbox. Here’s what I’ve found out after some investigation:
-
In selection won’t appear enabled if more than one selection is active, including a column mode selection (which is really several individual selections on different lines) – this is what @guy038 already discussed, and comes from this commit into the source code, which leads back to this issue.
-
Clearing of “marks” will now clear marks inside a selection, and bookmarks on lines touched by a selection, when In selection is ticked (otherwise it will affect the entire document). It comes from this commit into the source code, which leads back to this issue.
-
Purging of existing “marks” (via the Purge for each search checkbox) will only clear marks inside a selection, and bookmarks on lines touched by a selection, when In selection is ticked (otherwise it will affect the entire document), before the running of a new Mark All operation. It comes from this commit into the source code, which leads back to this issue.
That’s all I could find about In Selection changes on this Christmas night. Peace.
-
-
Hi, @alan-kilborn, @Scott-sumner and All,
Alan, I also investigated regarding the new features, of the Find dialog and its others tabs, recently added. Hence, the table, below, which recapitulates
9
enhancements, mostly created by @scott-sumner, as N++ contributor ;-))Note that you’ve already reported about the first
3
issues !•------------•----------•--------•--------------•----------•------------------------------------------------------------------------------------------------------------•----------------------------------------------------------------------• | Issue | Issue | Issue | Issue | First N+ | Issue | | | Author | State | Number | Date | release | Description | Link | •------------•----------•--------•--------------•----------•------------------------------------------------------------------------------------------------------------•----------------------------------------------------------------------• | sasumner | closed | 7663 | 2019_11_25 | 7.8.2 | "Purge for each search" option for "Mark All" action should respect "In selection" option | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/7663 | | sasumner | closed | 7532 | 2019_11_09 | 7.8.2 | Count / ReplaceAll / MarkAll option "In Selection" should not be available with multiple selections | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/7532 | | sasumner | closed | 6271 | 2019_10_25 | 7.8.2 | "Clear all marks" action should respect "In selection" setting in "Mark" dialog | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6271 | | sasumner | closed | 6074 | 2019_08_19 | 7.8 | Find-All-in-All-Opened-Documents searches cloned document two times | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6074 | | sasumner | closed | 6042 | 2019_08_12 | 7.8 | Require Bookmark-line for Clear-all-marks to clear bookmarks | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6042 | | sasumner | closed | 6018 | 2019_08_07 | 7.8 | 'Bookmark line' Marking doesn't bookmark all lines of a multi-line match | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6018 | | sasumner | closed | 5974 | 2019_07_30 | 7.8 | "Mark" command respects unseeable "Backward dir" checkbox | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5974 | | sasumner | closed | 5973 | 2019_07_30 | 7.8 | "Find All in Current Document" doesn't work from macro | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5973 | | W1Ko | closed | 3546 | 2017_07_20 | 7.8 | Clear all marks also removes bookmarks | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/3546 | •------------•----------•--------•--------------•----------•------------------------------------------------------------------------------------------------------------•----------------------------------------------------------------------• | sasumner | open | 6043 | 2019_08_13 | ----- | Incomplete use of "Invalid regular expression" error message | https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6043 | •------------•----------•--------•--------------•----------•------------------------------------------------------------------------------------------------------------•----------------------------------------------------------------------•
May be, as a consequence of all these changes, since the N++
v7.8
, I also noticed an other enhancement ( Edit : see above, issue6042
) :If you previously did a
Mark
action, with the Bookmark line option ticked, then a click on theClear All Marks
button :-
Erases the red highlighting AND the blue bookmarks, all together, if the
Bookmark line
option is still ticked -
Erases the red highlighting AND keeps the blue bookmarks, if the
Bookmark line
option is presently unticked
I, personally, like this new behavior, as sometimes, after a
Mark
action, I prefer to get rid of all that red highlighting but I want to preserve all the bookmarks to move around with theF2
andShift + F2
shortcuts !Best Regards,
guy038
-
-
@guy038 said:
I also noticed an other enhancement : If you previously did a Mark action, with the Bookmark line option ticked, then a click on the Clear All Marks button…
I did some more research and it appears that one is this, also released in 7.8.0:
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/3546So maybe you wanna modify your table? :^)
-
Hi, @alan-kilborn,
Ah, yes I simply did a GitHub search with the criteria
author:sasumner
! So, you’re right and I even found out the6042
related issue !Thus, I’ve just updated my previous post
Cheers,
guy038