New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add preference to stop Notepad++ from automatically populating the search value with selected/adjacent text #3243
Comments
Seconding this. Employing Ctrl+F/H as a leisurely stroke to jump back to an already-existing dialog should not replace the contents that I had just written into it seconds earlier. Labor-saving for some, but for me, it's annoying how aggressively hand-hold-ey it is – imagine if someone repeatedly came to my keyboard and did all that. I'd love to have the permission to tell him to stop knocking down my search queries, forcing me to re-pick them again and again from the dropdown menu, or to paste them ad nauseum from the clipboard every iteration. This is an added behavior squatting on top of a conventional use case, and should be relegated to the specialized checkbox or hotkey where it belongs. |
This would be much appreciated. In the meantime, the answer given on stackoverflow is quite useful. Instead of {Backspace} I have used {Down} so that I always get the last used search item in there. |
Would it be better to add an option to enable/disable this behavior or remove it completely? |
In my opinion it's an anti-feature (similar to auto-correct), but I guess some people like it or just use it "as is". An option to disable it seems good enough. |
I'd like to try to implement this but it conflicts with a pull request I created some time ago, which has not been reviewed yet: #3487. I modified the options dialog for that PR - which is also neccessary for this issue here. (Is "this issue here" correct English?) |
Agree with this - Notepad++ auto filling the search with text is counter-intuitive and annoying for me. I would like to see (in order of preference): Interested to hear whether people do like the currently functionality, or whether it's just annoying everyone? |
This autofill feature is really annoying. |
Hand holding features should always be, at a minimum, opt-out. Such things will help some users but will be detrimental to others, and can easily (make or) break a product. |
+1 for disable |
Honestly, it is the only thing making me look for an alternative to Notepad++. It is a huge productivity hit for me. |
..is this still not an option in current builds? I've been fighting with this for what feels like forever. What's the point of remembering our last entered search info if it automatically replaces it with whatever text next to the cursor? I can maybe understand if we had SELECTED some text, but it automatically selects a full string without our input. As people are saying, this is a huge productivity hit, and I'm baffled it's been over 2 years without any change. |
Please add an option to disable this. It makes zero sense, and slows down productivity to a halt. Now before pressing "Ctrl+F" I have to double guess myself "Oh wait, what is my curser NEXT to?" Just add an option to disable this. Or ideally make it opt-in or completely remove it altogether. |
@dantek12345 |
@Ekopalypse Which is why the ideal solution would be an option to disable/enable it; keeping such features is fine as long as they are optional. |
@Chessax |
There is a tendency to not inundate the Preferences with tons of things. Ok, point taken that the Preferences is already quite "busy" (and, to go down this road, a lot of things there border on downright confusing, especially for noobs). And personally, I like the current behavior of ctrl+f and don't really think it needs a preference setting. I think the author agrees as this has been a long-standing thing. But I wouldn't get all up in arms about it if there WAS a pref. setting for it. :) |
@Ekopalypse Apologies if I came across as argumentative, it was just supposed to be a sidenote/emphasis. It can definitely be the default as it is now, but that doesn't mean it can't be opt-out. @ Ekopalypse @sasumner It's because this feature is something that deviates noticeable from other text editors, sure you can say "but you can just do 'this' and it will work as you want just as long as you do things like you normally don't", but that doesn't change the fact that notepad++ does things differently than to a fair deal of (new) users are used to. Which is probably also why terms such as "handholding" and "anti-feature" has popped up. |
@Chessax I know, everyone is hunting for the one and only tool, which can do everything one wants and in exactly that way how one wants it to behave but ... I guess this is only possible if everyone writes their own tools. :-) |
Obviously different folks want different things. I think this should be a customizable option. I agree we don't want to overload a tool with a billion configurable settings but I think this one is one worth having. For me it is about standardization, a smooth workflow, and productivity. None of the other tools/programs I use have this behavior so that is what I am used to. I switch between multiple tools -- in fact sometimes even multiple editors like Notepadd++ for JS files and SharePoint Designer for ASPX files -- so when one tool does something non-standard it negatively impacts my process flow. It breaks the rhythm and slows me down. Instead of doing something and expecting it to work the same everywhere, I have to stop and think/check what tool I am in and adjust my activity accordingly. Imagine if tomorrow some tool, within the app, changed the behavior of the tab key, or swapped the mouse buttons. I'm all about standardization and uniformity. With that said, I do think this should be a user customizable option. |
This is also very annoying. If I wanted to find the text near my random cursor location, I would copy it first. Please remove this 'feature' or add a checkbox in the find dialog to toggle the behavior. |
Happy late 2nd anniversary for this issue 🎉 |
Just opened a new issue about this because my previous one – from 2015! – was automatically closed in the recent purge, and now I've found this. It's like getting slapped every time you open the Search dialogue. Can we at least get some kind of response from the developers? Doesn't anyone triage these issues? |
Someone finds it useful. Someone finds it annoying and irritating. It is arrogant to assume all will prefer one of them. Hard to believe there is no way to change this behavior, while you can decide to reduce tab bar or not. |
@Stolenboot - I, again, went through the comments and don't see who acted arrogant so I'm a bit unsure to whom this is addressed.
Well, I would say, one of the guys who like it the other way (note, not meaning a previous poster but in general a person who like it) might make a PR with the changes needed. I mean for example, why should I waste my time trying to implement this if I like it how it is. (Note, again, not saying that I'm capable of doing it at all) |
Most of the time, I don't want "Find what" to be auto-populated, and find it very annoying. But sometimes I do want it. A checkbox in the Find dialog to toggle this would be great. In addition to this, a solution at the keyboard shortcut mapping level would be useful. Allow the user to map hotkeys to any of these things:
Of course, that's a lot of mappable shortcuts, and good ergonomic hotkeys are at a premium. But most users wouldn't need to map all of them. Example minimalistic mappings:
or:
Now, say you want to do a Replace with auto-population, with this hotkey set. You could just press Alt+Shift+F followed by Ctrl+H to switch to the Replace tab of the Find dialog (at that point, what type of auto-population the key does would be irrelevant, because you're already in the dialog). However, this would require changing another behavior. Currently, when in the Find dialog, pressing Ctrl+H doesn't switch to the Replace tab of that dialog; it backspaces. And pressing Ctrl+F doesn't switch to the Find tab; it just recenters the Find dialog while staying in whatever tab you were already in. |
For those who always use the keyboard shortcuts, unpopulated Find/Replace/Mark can be achieved by installing the LuaScript plug-in, and redefining (some of) the shortcuts (Plugins > LuaScript > Edit Startup Script). Before restarting NPP, clear the redefined shortcuts in the Shortcut Mapper. npp.AddShortcut("Unpopulated Find", "Ctrl+F", function()
if editor.SelectionEmpty then
editor:AddText(' ')
editor:CharLeft()
npp:MenuCommand(IDM_SEARCH_FIND)
editor:CharLeft()
editor:Undo()
else
npp:MenuCommand(IDM_SEARCH_FIND)
end
end)
npp.AddShortcut("Unpopulated Find in Files", "Ctrl+Shift+F", function()
if editor.SelectionEmpty then
editor:AddText(' ')
editor:CharLeft()
npp:MenuCommand(IDM_SEARCH_FINDINFILES)
editor:CharLeft()
editor:Undo()
else
npp:MenuCommand(IDM_SEARCH_FINDINFILES)
end
end)
npp.AddShortcut("Unpopulated Replace", "Ctrl+H", function()
if editor.SelectionEmpty then
editor:AddText(' ')
editor:CharLeft()
npp:MenuCommand(IDM_SEARCH_REPLACE)
editor:CharLeft()
editor:Undo()
else
npp:MenuCommand(IDM_SEARCH_REPLACE)
end
end)
npp.AddShortcut("Unpopulated Mark", "Ctrl+M", function()
if editor.SelectionEmpty then
editor:AddText(' ')
editor:CharLeft()
npp:MenuCommand(IDM_SEARCH_MARK)
editor:CharLeft()
editor:Undo()
else
npp:MenuCommand(IDM_SEARCH_MARK)
end
end) |
A dichotomy. That's the true answer: Sometimes you want it and sometimes you don't. I like @xylographe 's proposed "solution". |
Some other solutions are available on this page: https://community.notepad-plus-plus.org/topic/12864/notepad-should-not-fill-the-search-field-with-default-text-when-search-window-was-already-open-and-filled |
I hate saying this but I actually moved to VS Code from Notepad++ and this was one of the main reasons. :/ I'll keep checking NP every now and then to see if anything changes. |
Thanks for the Christmas present. |
@donho said:
Yes, THAT is an OK change. A lot of different ideas were discussed in the comments of this thread, so I was not sure what you had chosen to implement. |
@donho Thank you! Looking forward to the next release! For cross-reference, here are related issue reports: |
Wait a second. The main annoyance in all these issues, including this one, is auto-filling the dialogue with unselected word that's under the caret or next to it, not with selected word, so this commit doesn't really solve it. Filling the find/replace dialogue with the selected text is a well-known and obvious behaviour, and I would guess most people find it useful and will keep it enabled. Having that option also include the unselected text is non-standard, unexpected and of questionable help, and if it's implemented at all, it should have its own separate setting and be disabled by default. |
To be honest, auto-filling the search field is annoying to me, whether the word is selected or not. It also feels stupid when I select multiple lines and want to do a search in selection, and find that my search word is replaced by the selection. Of course, this is highly personal opinion due to my personal way of working. I am happy that Don Ho is making the change. Respecting the diversity and not forcing people to work in one way, that's important for user experience. |
@aaaxx said:
Not sure where that opinion comes from. The reference everyone typically cites is the Visual Studio code editor. When you have the caret in a (unselected) word in that editor and invoke Find with ctrl+f, that word is used to populate the find box in the Find window. |
@Stolenboot said:
That one is a threshold thing. If you select enough text, then it does the opposite: leave the Find text alone and auto-ticks the In-selection box. The "cure" in your case is to use the mouse to refocus input to the Find window, not ctrl+f to get there. Yes, I know, probably not ideal...
Yes, while trying to balance not having an extreme amount of Preference options controlling all this variation. |
Didn't know about VS Code, and I don't remember seeing it in any other text editor. Sublime is also very popular and it doesn't behave that way. Still, the fact remains that that's the particular behaviour all these issues were raised about, and tying it to the option for selected text gives you no easy way to fill the dialogue when that is disabled. |
@sasumner I respect your opinion on limiting preferences, and I definitely understand your point of view. In my opinion, for a tool like Notepad++, the more options and customization abilities, the better. The first plugin I always install is the excellent Customize Toolbar plugin. From there, I go through everything in the Preferences UI, and tweak to my heart's content. There are good arguments for limiting preferences, and good ones for adding more. Personally, for Notepad++, the more the merrier. |
In my case, the problem arises when I close the Find window to go back to the text and declutter my screen (with Escape, to keep my hands on the keyboard), I open it again the search further the same string, to find out that NPP replaced my previous string by something completely random and irrelevant. I just compared with the 3 tools I have at hand: IntelliJ IDEA, Qt Creator and MS Notepad. IntelliJ IDEA and MS Notepad prefill the search dialog with the selection if any, but not with the word where the cursor is. Qt Creator does, but it has a specificity: when pressing Escape from the search dialog, it goes back to the main editor, but the search dialog stays open. Pressing CTRL+F goes back the the search dialog without changing the search string. That allows to continue where one left. Summarizing, NPP's huge search dialog makes me close it often, and the prefilling of the search string kills my "search sessions", while this workflow works fine with some other tools. |
@aaaxx said:
I didn't say "VS Code", I said the "Visual Studio code editor", which I'm sure way way more people use than "VS Code". |
@Gitoffthelawn said:
Actually, not really me... Just a long observation (by me) of Notepad++ evolution seems to hint at a ton of Preference configurability being not desired (by the dev team) |
@ocroquette said:
and:
Oh, absolutely. This is a key point on a single monitor system with the main N++ maximized. The Find window, if left open, is NEVER in a good place. As soon as you start talking about a 2+ monitor system, though, it is OK because (at least what I do) is put the Find window on the top right of the monitor I have to the left of the one I have a maximized N++ on.
One lame workaround to this is to put the caret NOT in a word, e.g. in a whitespace area before pressing ctrl+f. (Yea, I know...lame). Less lame is to use the mouse to get the Find window back (which will retain the existing search string), but for the people that are dedicated keyboarders this disrupts workflow. I'm not a dedicated keyboardist, so it is a compromise that works well for me. |
Ah, thanks for clarifying.
This. One of the solutions I've tried is using the Incremental Search functionality. The big limit on it is that it doesn't seem to respond to F3 to find the next occurrence. It also doesn't work with the next/previous buttons on the main toolbar. Maybe it can be improved. Is there any way to add a search field to the main toolbar? That would really help. |
@Gitoffthelawn |
This comes down to the process folks follow, their workflows, and muscle memory. I am sure if I never used any editor, including things like Notepad, Word, a text box in a browser, or anything and I started with Notepad++ then I'd get used to the CTRL+F behavior and probably be annoyed when other tools don't follow it. But that is not how things go. Most folks have a pretty strong process/workflow and muscle memory before they come to Notepad++. I've used many editors and NONE of them pre-fill the find criteria. So when a tool does, it breaks my workflow/process and is jarring to my muscle memory. I think VS Code does it but you can disable it -- which I have. Some people like it because it fits with their workflows. Some don't. With a development tool, why not make it configurable? Let the folks decide what they want. Everyone wins! |
@imthenachoman Hmmm. I mentioned above Visual Studio's code editor (which is NOT the same as VS Code) is probably the most common code editor out there that everyone with a Windows C++ programming background some time over the last 20+ years has used (maybe not liked, but used). And it WILL autopopulate the Find field with the word the caret is on by default (at least the most recent versions do it that way; can't remember but presume its default has always been that way). However, it's a moot point, and I don't want it to get lost: Notepad++ 7.8.3. will have the option to disable or enable this feature. So there's that. But, a key point for some people is probably going to be: Sometimes you want the autopopulation, sometimes you don't. Notepad++ won't be able to read your mind; you'll either have it off or on. That's why some people advocate a command (keystroke) for calling up a Find with the word at the caret autopopping the find box, and a different command (keystroke) for calling it up without any change to the find box. (Note: I'm not advocating that personally, but it has been suggested). |
@sasumner I think, it would be useful to have “Focus on Search/Replace dialogue” (cfr. “Focus on Another View”) in the Shortcut Mapper. Ideally, if a shortcut is defined, it would work as a toggle. |
Thanks very much @donho. This is what I wanted. |
Has this been added yet? I can't seem to find the setting in the dialog box or preferences. For what it's worth, the problem with auto-selecting text for me is that N++ moves the internal text pointer to the END of the selection, so if I'm at the beginning of a line doing a RegEx search, it highlights the first word, and then any search I enter starts from the end of that word rather than the beginning of the line. So I have to open the Replace dialog, go back to the editor and move the caret to the beginning of the line and then proceed with my search. OR I need to add a blank line and start my Replace from there. |
Okay, the setting for this is in I would have preferred "Don't auto-select a word if one isn't already selected, but if one is selected, go ahead and use it." I think that would strike a nice balance between everyone's needs. Thank you for your hard work @donho |
Hmmm, well you can go ahead and try it for yourself; here's how:
|
Thanks for fixing this. I found and disabled the option in settings. Notepad++ is much more intuitive for me now with finding text. |
The option moved to |
@sasumner, I apologize, I wasn't clear. I don't just want to change the dialog box text, I want to actually change the way it works. The current options are:
I would prefer that one of the options would be:
|
I do agree, but the options you mentioned are present in 8.3.3/8.4.1 ? I can only see option 1 |
Somebody has already described it in detail.
See: stackoverflow.com/questions/17710122/keep-notepad-from-automatically-populating-the-search-value-with-selected-adja
I think the person was right; this feature is counterproductive, at least for power-users. Please add an opt-out. I'm quoting portions of the said report below.
Steps to Reproduce the Issue
"In Notepad++, when you do Search -> Find, it automatically populates the "Find what:" field according to the behavior below (per the online documentation):
Expected Behavior
"Is there a way to change or disable this behavior? I would prefer that it come up empty. I don't mind the last searched pattern as a reasonable default, but it drives me nuts when it keeps changing the search value by automatically selecting a word next to the cursor."
The text was updated successfully, but these errors were encountered: