Use of "Wrap Around" changing start position of search if "Replace All" button pressed



  • I should start by outlining this as a continuation of a problem presented on how to insert newline characters into a single line file at predefined points. It quickly evolved into a discussion about what the “Wrap Around” button actually means with respect to the use of “Replace” and “Replace All” buttons.

    the link is here for those who wish to see the entire conversation.

    Currently we have that:

    1. If the “Replace” button is pressed the search commences at the current position of the caret (cursor).
      a. If “Wrap Around” is ticked, once the end of the document is reached the next press of “Replace” will continue searching from the start of the document.
      b. If “Wrap Around” is unticked, once the end of the document is reached, the next press of “Replace” button will elicit a sound and a message stating “no occurences found”.
    2. If the “Replace All” button is pressed then the “Wrap Around” selection determines the starting point for a search/replace.
      a. If “Wrap Around” ticked the search commences at the start of the file regardless of where the caret is currently located.
      b. If “Wrap Around” is unticked then the search commences at the current position and will finish at “end-of-file”.

    There have been 2 examples presented by @Alan-Kilborn and @guy038 confirming (proving) the “Replace All” with “Wrap Around” ticked description provided above (2a). There has now been a GitHub issue raised with respect to the online manual description being deficit in this description.

    I actually want to raise this a step further as I find it a rather confusing setup. For me, “Wrap Around” describes a situation where regardless the position of the caret within a file, proceeding forwards (or backwards) along the characters one finishes up back exactly where one started (actually 1 character before/after depending on direction. So EVERY character is looked at at least once).

    So with respect to “Replace All” I find the words “Wrap Around” to be misleading. There is no wrap around, instead there is a reset of caret to start of file, the process (search/replace) starts and then the process finishes at the end of the file.
    If the “Wrap Around” button is not selected then the search (“Replace All”) commences wherever the caret is currently located and finishes at the end of the file.
    In respect to the “Replace” button each time it is pressed the search proceeds to the next “find”. It will stop if “Wrap Around” not ticked at the end of the file. If “Wrap Around” is ticked it is allowed to (re)start at the start of a file and continue through, effectively completing 1 whole circuit through the file’s contents.

    So if my statements above and my synopsis are correct we really have 2 different processes at work. The words “Wrap Around” relate ONLY to the “Replace” button in that it is allowed to process the entire file regardless of start position.
    If we use the “Replace All” button I think there needs to be a “different” button stating whether the process commences at the start of the file or not. But it is NOT a “Wrap Around”!

    I don’t wish to create a discord in the community, nor with the developers but I feel I need to voice my opinion in this matter. I do however welcome further discussions on this matter, and if someone feels they can explain it logically why this is OK I am prepared to listen and possibly change my current stance.

    Terry

    edited as I had a word art created table included, but formatting of it was useless so removed.



  • Hello, @terry-r and All,

    @Alan-kilborn said in this post :

    BTW, a posting somewhere here long ago (I think) said to think about Wrap around ticked as meaning “Entire document” in this (Replace All) circumstance, and I’ve always remembered that, as it seems to be appropriate

    So, in theory, I think that the Wrap-around option should be rewritten as :

    ☐ Wrap-around / Entire file (Count / Rep. All / Mark)

    Besides, when the Wrap-around option is ticked, note that the message, displayed in dialogs, ends all with the string in entire file !

    Refer also to my old table below :

    https://community.notepad-plus-plus.org/post/27946

    Best Regards,

    guy038



  • This post is deleted!


  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    If we use the “Replace All” button I think there needs to be a “different” button stating whether the process commences at the start of the file or not. But it is NOT a “Wrap Around”!

    If this bothers you that much, a possible solution is shown in the thread Guy linked to. And that solution is to change the text on your Replace window. Here’s how I have customized mine, as a reminder of how this works:

    Imgur

    I think there needs to be a “different” button

    Good luck with your campaign to get the UI changed. Hint: You very probably won’t succeed. :-)

    Given that there are not a large amount of user complaints about this, IMO this is not a “problem”. Meaning that it isn’t “getting in anyone’s way”. It can still be thought of as a “wrap around” by the majority of users, to no detriment. Again, my opinions only.

    But, it was surprising the number of “power users” that didn’t understand this behavior until I pointed it out in that other thread.

    If the “Wrap Around” button is not selected then the search (“Replace All”) commences wherever the caret is currently located and finishes at the end of the file.

    Or the beginning of the file if Backward direction is ticked.

    But… even a Replace All of this type may work differently than you think. I believe that here it actually does a “forward” search from position 0 to the position of the caret. Contrast this with a single-step Replace in the backward direction, which definitely starts at the caret position and keeps looking backward for the match.



  • @Alan-Kilborn said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    Given that there are not a large amount of user complaints about this, IMO this is not a “problem”.

    I disagree with your statement. IMO users have not complained for 2 reasons:

    1. They didn’t associate that change in logic when using that combo (Replace All with Wrap Around selected). The result still turns out the same as if one assumed the search started at current position.
    2. The User Manual outlines the logical explanation, which now appears to be wrong.

    Further to bolster my claim that it’s not logical is that yourself and possibly @guy038 have customized the UI so that it reminds you that the process is something else entirely.

    I asked for someone to help me change my stance as to why it should be this way, so far I only have evidence that suggests it’s wrong or at least confusing.

    Now I will admit to seeing the logic of a Replace All with Wrap Around (not my choice of words for this combo) selected starting a search from the beginning. And to be fair I presume most of our solutions do make that assumption or at least we understand our solution is not conditional on the placement of the caret.

    As to getting the UI changed, possibly not, but I feel raising it as a confusing situation might lead the developers to reconsider and if maybe some other changed need in the future opens the door to also consider this change I will feel I’ve done my bit by raising the matter now.

    Terry



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    There has now been a GitHub issue raised with respect to the online manual description being deficit in this description.

    @PeterJones I gather your are the POC for the online manual. I just tried the link under FAQ section for the manual and didn’t get anything loaded, instead got a “… took too long to respond”. Has the edits of the manual (I saw the updated github issue) caused a problem?

    Terry



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    Further to bolster my claim that it’s not logical is that yourself and possibly @guy038 have customized the UI so that it reminds you that the process is something else entirely.

    Well I certainly would not be opposed to the UI for this checkbox being changed to “Wrap around / entire document”, as that would make it unnecessary for me to customize my copy of Notepad++. :-)

    But then it is potentially more confusing, as the “wrap around” part would apply only to Find Next / Find Previous / Replace and the “entire document” part would apply only to Replace All / Count.

    But, aside from reading the user’s mind about what button they are about to press, this split nature can’t be made better.

    But really, “wrap around” does in a sense convey the “entire document” is to be covered, doesn’t it? So in truth I think it is okay the way it exists currently.

    Or perhaps you have another idea for how the UI might be made better in this regard?



  • @Alan-Kilborn said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    this checkbox being changed to “Wrap around / entire document”

    What hope is there for me to suggest a change better than what you just offered in the 5 minutes since I became aware of this. It will need some consideration. Interestingly the github article @PeterJones mentioned earlier when he asked seasoned user (now on development team) Scott, Scott’s own UI had been customized in a similar fashion.

    So I think seasoned users who are aware of it (and have been for some time) customize the UI to remind them (so what does that say!). The rest of us; now that we are also aware; will have to consider our options. Newbie’s are probably none the wiser from all this, and possibly don’t really care as long as their data is edited as they expect from our solutions.

    So going forward, now that I’m aware, no longer will I insist of those who supply solutions to include "must have cursor (caret) in first position before pressing “Replace All” in those circumstances where it’s warranted, just so long as you ALSO mention “Wrap Around” must be ticked. :-))

    Cheers
    Terry



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    What hope is there for me to suggest a change better than what you just offered in the 5 minutes since I became aware of this

    Haha, well, you’ve been considering it for more than 5 minutes, I’m sure. This one seems to have “motivated” you. :-)

    Scott’s own UI had been customized in a similar fashion…

    Well, I certainly have pulled a lot of my “good” ideas from others on this forum and other places. I didn’t claim to have invented the solution of hand-customizing the UI. :-)

    seasoned users who are aware of it … customize the UI to remind them (so what does that say!).

    Really, though, customizing the UI text is somewhat of a joke, and here’s why: If I know about the behavior, I no longer would be in need of such prompting. I just modified my UI text because I saw someone else do it, and it is possible to do so. I do so in other areas as well, where the default English text is a bit “rough”.

    no longer will I insist of those who supply solutions to include "must have cursor (caret) in first position before pressing “Replace All” in those circumstances where it’s warranted, just so long as you ALSO mention “Wrap Around” must be ticked

    Ha. This latter part is what I’ve been doing all along, you just haven’t noticed, because you weren’t aware. :-)

    Seriously, though, if you have a better UI solution, or a non-UI solution to make this situation “better”, please share it.
    Maybe the code should be changed to do TWO searches in such a case, to implement true wrap-around behavior.
    Would this reduce potential confusion?
    I don’t know…



  • @Terry-R

    Dangit, Terry, you’ve got me really considering this now!

    So Replace All really isn’t replace-all, anyway.
    It’s only replace-all if Wrap around is ticked.
    Without that checkbox ticked, it’s what? “Replace partial”?

    Maybe just a testament to the statement “Good UI design is difficult”.



  • @Alan-Kilborn said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    Without that checkbox ticked, it’s what? “Replace partial”?

    Technically, that button always performs “Replace All matches in a specific region”, where that region is influenced by the settings of Wrap Around and Backward Direction.

    You might want to look at the changes in PR#179 and see if we’re doing a good job at more-accurately describing the situation for Replace All. (Scott and I have gone through a couple of back-and-forth, trying to get the description as good as we can.)



  • Hello @terry-r, @alan-kilborn, @peterjones and All,

    Finally, I think that :

    • The Find All in Current Document should be called Find All in Current Doc / Selection

    • The Replace button should be called Replace Once

    • The Replace All button should be called Global Replace ( or even just Replace )

    • The Mark All button should simply be called Mark


    So, in the Replace dialog :

    • If the Wrap around option is On, Global Replace acts on entire doc, from beginning of file to end of file

    • If the In selection option is On, Global Replace acts on current selection, from its beginning to its end

    • If none of these options are On and the Backward direction is On, Global Replace acts from beginning of file to caret location

    • If none of these options are On and the Backward direction is Off, Global Replace acts from caret location to end of file


    Remark that these four rules, above, also apply to the Count and Mark buttons ;-))

    Best Regards,

    guy038

    P.S. :

    In the end, all these possible changes seem rather “cosmetic” ! The only thing that matters and that should be kept in mind, is the extent to which a given button acts ;-))



  • @PeterJones said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    and see if we’re doing a good job at more-accurately describing the situation for Replace All.

    @Alan-Kilborn @guy038 I think the “real” issue we have here is that currently the options aren’t logical. As I stated earlier 3 of the 4 possibilities relate to commencing a Search/Replace from current position (in the direction requested) to either top/bottom of file (or other end of selected search area) or the same position through use of wrap around.

    The 4th option discards that idea and completes a logical top to bottom (or can it also be bottom to top?) Search/Replace.

    It almost appears that there should really be 5 options where the current 4 ALL commence from current position. The new 5th option would be a logical end to end file search/replace.

    So then the next question is, can a “Replace All” starting from current position and finishing at the same place (wrap around) make different changes to one processing the whole file logically top to bottom (or bottom to top). I’d hazard a guess at yes as suggested by a few examples already provided.

    Of course my idea means we lobby the developers to re-think the UI (and add the 5th option), whereas currently we are ONLY looking at re-thinking the manual. So maybe do both, manual update in short/medium term as that is what we DO have. Long term consider whether the UI actually needs altering.

    Food for thought?

    Terry



  • Without that checkbox ticked, it’s what? “Replace partial”?

    @PeterJones said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    Technically, that button always performs “Replace All matches in a specific region”

    Well, we know that.
    But not-so-power-users are going to have a different interpretation of “All”.



  • @guy038 said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    Finally, I think that :

    The Find All in Current Document should be called Find All in Current Doc / Selection

    The Replace button should be called Replace Once

    The Replace All button should be called Global Replace ( or even just Replace )

    The Mark All button should simply be called Mark

    Not to be disagreeable, but I think current labeling is better than all of these. :-)
    It could be because I’m used to the current labeling.



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    The 4th option discards that idea and completes a logical top to bottom (or can it also be bottom to top?) Search/Replace.

    I think 4th option = Replace All with Wrap around ticked ?
    If so, then No, it can’t be bottom to top, it is always top to bottom.

    I’d hazard a guess at yes as suggested by a few examples already provided.

    It is a most definitely a Yes.

    my idea means we lobby the developers to re-think the UI

    I think you’d have to approach them with a definite idea.
    But even then it would be a hard sell, I think.
    UI is very subjective.



  • @Alan-Kilborn said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    If so, then No, it can’t be bottom to top, it is always top to bottom.

    That would imply that the “full file” search/replace also ignores “backward direction”. Since some users seem to have that need, does that mean they can never really complete a full file search/replace in their selected mode (backwards) unless the cursor IS in last position in the file? (this bit of logic escapes me currently so I might have it totally wrong)

    I terms of my 4th (current) option, yes it was referring to “Replace All” with “wrap Around” ticked.

    My words “I’d hazard a guess” were a bit tongue in cheek, since it had been proved (you and @guy038 little tests in other discussion).

    If we did have 5 options, where the first 4 were the current ones, but ALL commencing at current position and proceeding according to the “backwards direction” and “wrap around” selections and also complying with any selection area. Would anyone actually consider using the 4th, being starting at current position and proceeding in direction selected with wrap around so that the whole file was processed. Or would they just elect to select the 5th (new) option such that they KNEW beyond doubt (over where their caret was) that the file would be processed logically from start to finish, whole file!

    Because if the 4th option would be very unlikely to be used, then maybe that’s what the developers decided also, and then elected to slot the 5th option into where the 4th option currently is. And now we find ourselves in this logical confusion where the UI wording is a bit misleading.

    So I seem to find myself back at the current 4 option but with the UI and manual needing a bit of tweaking.

    Terry



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    So I seem to find myself back at the current 4 option but with the UI and

    How about:

    55565a76-3bfb-4a27-bf59-86e17b9a5d03-image.png

    as a potential candidate?

    So

    1. “Replace (Single)” is a single replacement with the next find positioned next to caret. If text is not currently highlighted it instead “Finds” (starting at current caret position) and awaits a second press for the replacement to proceed and then continues to “Find” the next potential replacement text. It complies with “backward direction” and “wrap around” selections.
    2. “Replace (Multi)” will make multiple replacements complying with the “backward direction” and “wrap around” selections. It commences at the current caret position.
    3. “Replace All” ignores ALL other settings and completes a “top to bottom” run.
    4. “Replace All in All Opened Documents” is the same as #3 with all opened documents.

    So straight away the user has to acknowledge there is a difference between the “multi” and “all” buttons, even if they don’t know exactly what they mean initially. It also still allows the “Replace All” button to be associated with it’s sibling, the “Replace All in All Opened Documents” button.

    Terry



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    “Replace (Multi)” will make multiple replacements complying with the “backward direction” and “wrap around” selections. It commences at the current caret position.
    “Replace All” ignores ALL other settings and completes a “top to bottom” run.

    I should have said:
    2. “Replace (Multi)” will make multiple replacements complying with the “backward direction”, “wrap around” selections and any “in selection” area. It commences at the current caret position.
    3/ “Replace All” ignores caret position, “Backward direction” and “Wrap around” selections and completes a “top to bottom” run.

    Terry



  • @Terry-R said in Use of "Wrap Around" changing start position of search if "Replace All" button pressed:

    So straight away the user has to acknowledge there is a difference between the “multi” and “all” buttons, even if they don’t know exactly what they mean initially

    Sorry to do it again, so soon, BUT…
    I realised from the above statement that it would not be initially clear about the difference but the user must know there had to be one. Rather than make them go looking for it here is version 0.2 which shows them the difference.

    40d64225-ba17-493f-b677-87037ca00d2a-image.png

    So here I moved the “Wrap around” up to be with the “Backward direction” selection. Then surrounded them with a “ghost line” and titled that area. Now it’s obvious those 2 selections are for the “Replace (Single)” and “Replace (Multi)” buttons. Thus they aren’t available for the “Replace All” or “Replace All in All Opened Documents” buttons.

    So now the “Backward direction” and “Wrap around” are grouped together as they are direction based selections. And the “Match case” and “Match whole word only” selections are also grouped together as they as both “regex” string functions. Have I also tidied up another issue which no-one had seen until now? These 2 groups could also be moved further apart signifying their different type of functions.

    Terry


Log in to reply