Make "Find Next" / "Find Prev" buttons an option
-
I was okay with either the two button or the toggle - but the latest version 64-bit, doesn’t seem to have either!. The tool tip on Find Next tells you to do shift enter to search up and I’m sort of getting used to it, but a lot less obvious than having something on the box. (enough to keep me from updating my other machine.)
-
The toggle – if what you mean by that is the Direction group box with the Up and Down radiobuttons (present pre-7.4.2)-- was not restored in 7.5 and later (when the <<Find button design of 7.4.2 was backed out), but rather was replaced with a single control called Backward direction (a checkbox). It’s with the other checkboxes on the left side of the Find window.
Instead of toggling between two radio buttons, you just either check or uncheck the checkbox. Equivalent but different…
If this (or ANY posting on the Notepad++ Community site) is useful, don’t reply with a “thanks”, simply up-vote ( click the
^
in the^ 0 v
area on the right ). -
Please, bring the “find prev” option back, I mean, why do I have to do 2 clicks (backward edition > next) instead of 1, this is not comfortable. Why ever removing this button? Really disappointing.
-
Well, if you want to do just one operation, forget the Backward direction checkbox and the Find Next button, and simply press Shift+Enter to “find previous”, as the popup hint for the Find Next button shows :
It may be little known, but Enter by itself performs the “find next” functionality; as the *Find Next" button is the “default” button in the Find window.
-
Clarification on that last bit of advice:
It should have said:
…forget the Backward direction checkbox (leave it UNTICKED) and the Find Next button…
The reason for this is that using the Shift+Enter and Enter keyboard controls respects the state of the Backward direction checkbox. To me, this is bad design: I’d rather be able to count on a specific keypress here always moving the search in the same direction.
Of course, once you’ve found the first match, moving back to the document tab window and using the Find Next and Find Previous keycombos (which always work to search downward and upward, respectively…NICE!) is probably the better option anyway.
-
Really missing this feature & have regressed to v7.4.2. Hope it gets fully fixed for future releases.
If the only problem is with Replace could it be added to just Find?
-
could it be added to just Find?
THAT was exactly the problem. Here’s a summary of what happened:
- change UI in a manner that affects Find, Replace, and Replace All features
- complete the change for Find, even giving it two keyboard options for direction (Shift+Enter added; Enter (alone) was there already)–REALLY NICE <<Find and >>Find buttons!
- leave Replace with an inconsistent UI (which direction is it going??..dunno…)
- leave Replace All with an inconsistent UI (which direction is it going??..dunno…unless Wrap around is checked–then we know–it’s the whole doc so direction doesn’t matter)
- realize what happened…OH, GOSH !!
- back out the addition of the <<Find button…but do it so that the UI is yet another change for the user (one checkbox vs. 2 radio buttons to specify direction)
But @David-Fox, I understand what you’re asking for. :-D
-
Hello, @Scott-Sumner and All,
I read carefully, all the posts of that discussion and I tried to analyse the different categories of buttons, in the four S/R windows ( Find, Replace, Find in Files and Mark ). All this was done with the last v7.5.1 version !
To my mind, after some tests, a mouse click on the buttons, below, always scan of multiple files ( except for the Find All in Current Document option ), from theirs very beginning to theirs very end and perform the appropriate replacements, if asked for
It’s important to notice that these global searches, and replacements, are totally INDEPENDANT of :
-
The status of the Backward direction option
-
The status of the Wrap around option
•---------------------------------------• | | Find All in All Opened Documents | | •---------------------------------------• | | in FIND dialog •---------------------------------------• | | Find All in Current Document | | •---------------------------------------• | •---------------------------------------• | | Replace All in All Opened Documents | | in REPLACE dialog •---------------------------------------• | •---------------------------------------• | | Find All | | •---------------------------------------• | | in FILES in FILES dialog •---------------------------------------• | | Replace in Files | | •---------------------------------------• |
Similarly, when the In selection option is ticked, a mouse click on the two buttons, below, scan any normal and single selection, doing the appropriate replacements, if any, from its very beginning to its very end, INDEPENDENTLY of :
-
The status of the Backward direction option
-
The status of the Wrap around option
•---------------------------------------• | | Replace All | | in REPLACE dialog •---------------------------------------• | ( 'In selection' option TICKED ) •---------------------------------------• | | Mark All | | in MARK dialog •---------------------------------------• |
So, this first category of buttons, above, does not really concern our discussion, about backward/forward direction, in searches/replacements. Their way of working is rather clear and I don’t think that we miss important information about them :-))
Now, of course, all the other buttons, which remain to study, act on a single file, only. For all of them, the key option is the Wrap around option. Indeed, depending on the status ( Ticked / UNticked ) of the Wrap around option, I think that the look and description of these buttons, sensitive to direction, should change, as below :
- With the Wrap Around option
UNticked
:
•------------• •------------• | Find | << Prev | | Next >> | | •------------• •------------• | | in FIND dialog •------------• •------------• | Count All | << Prev | | Next >> | | •------------• •------------• | •------------• •------------• | Replace | << Prev | | Next >> | | •------------• •------------• | | in REPLACE dialog •------------• •------------• | Replace All | << Prev | | Next >> | | •------------• •------------• | •------------• •------------• | Mark All | << Prev | | Next >> | | in MARK dialog •------------• •------------• |
- With the Wrap Around option
Ticked
:
•------------• •------------• | Find | << Prev | | Next >> | | •------------• •------------• | | in FIND dialog •------------------------------• | | Count All | | •------------------------------• | •------------• •------------• | Replace | << Prev | | Next >> | | •------------• •------------• | | in REPLACE dialog | •------------------------------• | | | Replace All | | | •------------------------------• | 'In selection' option UNticked | | | •------------------------------• | | | Mark All | | in MARK dialog | •------------------------------• |
Notes :
-
Due to the co-existence of the
<< Prev
andNext >>
buttons, the old Shift + Find Next functionality, from now on useless, would be suppressed ! -
As a remainder, when the Wrap Around option
Ticked
, the direction of searches, and replacements, is :-
From the cursor location till the very beginning, then, from the very end to the cursor location ( case
<< Prev
) -
From the cursor location till the very end, then, from the very beginning to the cursor location ( case
Next >>
)
-
Remarks :
-
When the Wrap Around option is
UNticked
:-
Find and Replace actions could be performed, one AT A TIME, from the cursor location, in the backward or forward direction, with the
<< Prev
andNext >>
buttons -
Count All, Replace All and Mark All actions would be performed, in ONE go :
-
From cursor location till the very beginning, with the
<< Prev
button -
From cursor location till the very end, with the
Next >>
button
-
-
-
When the Wrap Around option is
Ticked
:-
Find and Replace actions could be performed, one AT A TIME, from the cursor location, in the backward or forward direction, with the
<< Prev
andNext >>
buttons, then looping, respectively, to the end / beginning of file, till the cursor location -
Count All, Replace All and Mark All actions would be performed, in ONE go :
-
In the backward direction, after a previous mouse click on the Find or Replace
<< Prev
buttons, then looping to the end of file, till the cursor location -
In the forward direction, after a previous mouse click on the Find or Replace
Next >>
buttons, then looping to the beginning of file, till the cursor location -
May be, if the regular expression search mode is ticked, it would be sensible to return to the first line of the current file, before running a Count All, Replace All or Mark All action
-
-
BTW, searching backwards, in regular expression mode, is quite possible :-)) For instance :
-
Open the usual license.txt file
-
Move to line 81 (
Ctrl + G
) -
Open the *Find dialog
-
Type
(?-si)the.*?are
, in the Find what: zone -
Choose the Regular expression search mode
-
Hold down the Shift button and, at the same time, click on the Find Next button, twice
-
Now, hit the Esc key to close the Find dialog
-
Go on, searching backwards, by using the Shift + F3 button !
Et voilà !
I agree that, for complicated or long regexes, this could lead, very often, to odd things ! But, although I totally understand this restriction, about regex backward searching, we could use this less restrictive rule :
If any << Prev button would be pressed, a short message, about possible unpredictable results could pop up, with, of course, the possibility to suppress any further displaying !
BTW, this regex looks for the shortest range of characters, located in a unique line, between the two strings the and are, whatever their case
Now, @Scott-Sumner, the differences between my suggestions and your beta Find/Replace/Mark dialog, are :
-
When the Wrap around option is
UNticked
:-
I added the two Count All << Prev and Count All Next >> buttons, instead of your unique Count button
-
I added the two Mark All << Prev and Mark All Next >> buttons, instead of your unique Mark All button
-
-
When the Wrap around option is
Ticked
:-
I just display a Replace All button, instead of your two << Repl All and Repl All >> buttons
-
I changed your Count button for a Count All button
-
-
On the other hand, you, strictly, apply the “no backward regex search / replacement” rule, included the Shift + Find >> action, which is inactive, when the Regular expression mode is set. However, remember that, when the S/R dialog is closed, any Shift + F3 action, still, searches in the backward direction :-))
To sum up, as far as I know, this set of buttons seem coherent and could be implemented. Probably, these new S/R panels would satisfy the great majority of users !
Best Regards,
guy038
-
-
pluto once was the ninth planet in our solar system
it got stripped of being a planet due to it’s inferior massbut in late 2017 a newly found object called “find prev”, which was encountered within the boundaries of earth’s gravity, was evaluated to be massive enough to be categorized as a planet ;-)
just kidding, i also liked the “find prev” planetary button, but to be honest the only difference was to click on another button instead of shift click the single search button as it was before and is now
-
@guy038 :
So these are not bad ideas. The biggest problems I see with implementation is the quantity of new proposed new buttons, because:
- screen space is limited, and
- so many new buttons makes it hard to have enough Alt+symbol (e.g. Alt+a = Replace All button press) key combinations for all of the controls
Another problem is that currently there aren’t buttons that disappear or change form (within one tab of the Find family dialog) depending upon the state of other controls. I fear that this, and some of the other proposed changes, are just “too much” to change all at once (Notepad++ seems to evolve slowly).
An additional thing to think about more is the proposed “<<Count” and “Count>>” features. I found that with certain regular expressions you can have matches that “straddle” the caret, thus there can really be 4 different match counts:
- matches that occur globally (anywhere in the file); this is existing functionality
- matches above the caret position
- matches below the caret position
- matches that straddle the caret position
Here’s some Pythonscript code that will demonstrate. Put the caret in the middle of a word before running this script (
CountAboveAndBelowCaret.py
):import re def CABABC__main(): search_str = r'\w+' search_str = notepad.prompt('enter a find-what regex', '', search_str) if not search_str or len(search_str) == 0: return caret_pos = editor.getCurrentPos() CABABC__main.match_above_count = 0 CABABC__main.match_below_count = 0 CABABC__main.match_global_count = 0 def match_found_above(m): CABABC__main.match_above_count += 1 def match_found_below(m): CABABC__main.match_below_count += 1 def match_found_globally(m): CABABC__main.match_global_count += 1 reflags = 0 editor.research(search_str, match_found_above, reflags, 0, caret_pos) editor.research(search_str, match_found_below, reflags, caret_pos, editor.getTextLength()) editor.research(search_str, match_found_globally, reflags, 0, editor.getTextLength()) notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, '{gc} total matches. {ac} matches above caret; {bc} below.{s}'.format( gc=CABABC__main.match_global_count, ac=CABABC__main.match_above_count, bc=CABABC__main.match_below_count, s='' if CABABC__main.match_global_count == CABABC__main.match_above_count + CABABC__main.match_below_count else ' 1 match straddles the caret.' )) CABABC__main()