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
Feature req: improved Find-Replace dialog interface #3985
Comments
See #3620 for more info on the existing logic behind when "In selection" gets checked/unchecked by Notepad++ |
This makes total sense, but "In Selection" should not only be enabled based on EOL selection - rather the "In Selection" option should be enabled if 1 or more characters are selected anywhere within the document - regardless of EOL inclusion (unless maybe I misunderstand the comment above). IF (Document selection contains 1 or more characters when invoking CHANGE -- [CNTRL+H]) |
@TroglodyteGuy , It is clearly up for debate, but in my opinion that falls more in the realm of what goes in the Find-what zone...see https://notepad-plus-plus.org/community/topic/14048/improvement-for-replace-dialog for more. |
@sasumner I see your point. I find that I want to change something within the selection more often, but I do use it both ways. I appreciate your point and link so that I can see the other point of view. I guess I'm good with current behavior - especially since I use it the way described in your link as well :). |
Having given it some more thought, I think that it would be best to base the initial "in selection" setting simply on whether the selection is empty or not (thanks troglodyteguy!): in-selection-setting = selection-is-empty ? unchecked : checked The user will always have to decide whether the selection is the stuff he wants changed, or the target of the replacement operation. It makes total sense (to me) to assume the latter if the selection is not empty. This should be a cinch to implement. |
Personally my workflow is to highlight something I'm replacing.. Ctrl+H it then prepopulates the search/replace string.. then I just type what I want it to be and submit. Now with the in selection option defaulting to on if something is highlighted means the replace turns into a single replace instead of a replace all. I want to just disable the in selection logic so I get a constant user experience. I like having that feature to limit a replace all to the selected area... But more times than not.. the logic turning it on messes me up because I expected it not to be on. |
I'm constantly wishing that npp would automatically check the In selection box for me, but after reading the comments above and the original thread on the forum, I can see that this issue is more nuanced than I initially appreciated. Qualitatively, I want In selection checked when I have a lot of text selected, and unchecked when I have a little text selected. Of course, defining "a lot" and "a little" seem to be the crux of the issue. For simplicity's sake, the EOL idea seems like a good solution to me. More often than not, if I have an EOL selected, I'm also going to be using In selection. If I'm interested in finding/replacing the actual EOL characters, themselves, I'm typically working with the Extended or Regular expression options, and am already mentally planning to spend some time in the Replace dialog. I don't expect npp to read my mind; I do think there's an opportunity to further automate a frequent operation that currently requires manual intervention. Having some threshold (EOL, character count, user preference...) that triggers automatic In selection would take a bite out of the times that I have to do this extra step. The remaining edge cases would be fewer in number. Honestly, the majority of the time I want to use In selection, my brain assumes it's checked > I replace the whole document by accident > undo the replacement > finally do it right. I don't know why I haven't learned better yet. Maybe because half the time I'm pasting code from npp to SQL Server Management Studio, which relies heavily on selected text? I'll learn one of these years - but this would still be a nice improvement. |
In UEStudio for example, if selected more than one line, it automatically set to "in selection", however if single word/line selected it use selected text as search keyword. |
THE ISSUE (FEATURE REQUEST)
When a selection is made in a document, and Ctrl-H is entered, the “In selection” option should automatically be set based on the selection made:
Update 2017-12-13: Read comments below. Current thinking is to use selection != empty as rule to set "in selection".
WHY?
When CTRL-H is hit, currently, the "In selection" checkbox is unchecked, even when a multi-line selection was made. However, if a multi-line selection was made before Ctrl-H, it would make sense to assume that the user wants to replace something in the selected part of the file.
Of course the user would always be permitted to change the default presented for "in selection".
IMPLEMENTATION
if (selection-contains-any-eol)
{
in-selection = checked;
}
else
{
in-selection = unchecked;
}
The text was updated successfully, but these errors were encountered: